My Contribution
to the Public Domain
Well, here is my humble contribution to the Public Domain, sorted
roughly in chronological order.
I hope you will find some of the following helpful ...
There is also
older stuff,
in which probably no one is interested any longer.
Shrink PDF's File Size
This
shell script
will shrink the size of PDF's (mostly by compressing images further).
This comes in particularly handy with the current version of Powerpoint (on Mac)
to create huge PDF's.
It uses ghostscript to do so, so you must have that installed.
Usage: pdfshrink.sh file.pdf
Compress Movies in the Photos app
This
Automator Workflow
helps with compressing movies you have in your photos library in the
Photos app, so that they take up less space on the hard drive.
It does so by reducing the size to 720p and the bitrate to 7 Mbit/s.
(Reductiom of file size is around 2-5x .)
You can change that, of course, in the Automator workflow.
This is how to use it:
-
Unzip the file
-
Run the workflow
-
Select one or more movies in the file selector that opens.
(For the movies in portrait format,
you probably won't see the little movie symbol in the lower
corner like for the landscape movies, but that is a bug in the
Mac OS.)
-
Let the workflow run; depending on how many movies you seleected,
this can take several minutes.
(If you want, you can watch progress by watching the folder /private/tmp
for files with file extension .m4v .)
-
At the end, the Photos app will appear in the front,
and you should see one movie after the other being imported.
Don't interrupt this.
-
After importing has finished for all movies,
the new, reduced movies will appear next to the original ones
in the moments in Photos. You can now delete the old, large movies.
Note: this Automator workflow is not robust: if anything goes wrong
during execution, it just stops, probably with some error message.
Sorry.
The Automator workflow can (and should) be improved in many places.
The most wanted improvements (IMHO) are:
-
Transfer the place/location (i.e., GPS coordinates)
from the old movie to the new one.
-
Allow the user to choose from different compression rates at the
beginning (e.g., 480p, 720p).
-
Optionally, the workflow should delete the old, large movies from
Photos.
I would appreciate your help (by hints or patches) very much.
Extract all filenames of all movies in Powerpoint files
This
shell script
can extract all filenames of all movies that are linked
from a Powerpoint file.
Prerequisite is that it is a pptx file.
Usage: extract_movie_filenames_from_ppt.sh file.pptx
It extracts only the filenames, not the paths, but with the
search facility of your platform, it should be trivial to find them
given the filename.
Experiments on Approximate Nearest-Neighbor Search using kd-Trees
(with Python Code)
In this
set of experiments,
I wanted to determine
under what circumstances and parameters the approximate
nearest-neighbor search using a kd-tree is significantly faster
(in practice) than the exact nearest neighbor search using a kd-tree.
As you know, there is always the curse of dimensionality.
Batch convert all Powerpoint files in a folder to PDF
Here is a
Applescript program (zipped)
for Mac that will convert all Powerpoint files in a folder to PDF in a batch.
(For Google, here it is again
as a plain text file.)
You need Powerpoint:mac 2011.
Apparently,
this should also be possible (and easier) with Automator, but the required Automator actions
are not installed on my machine, and many others', too (which seems to fit the common Micro$oft practice,
that everything has to be paid and installed extra).
OpenGL Transform Feedback Example
Here
is a simlpe, self-contained example program (actually, three) that demonstrates the Transform Feedback of OpenGL.
It shows two triangles (or 2x2 points, resp.), the latter of which is a copy of the former that was obtained via
the Transform Feedback.
I have developed and tested the program under Mac OS X 10.6 using XCode 3.2 with an ATI graphics card.
So it should also compile as-is under Linux (you just need Glut).
Since getting the transform feedback to work has caused me considerable headache (I also needed a lot of help),
I thought I'd post this
TAR file.
Hopefully, it will help reduce the headache of others.
Concatenate movies automatically
Here is a little
Automator Workflow,
with which you can concatenate a
number of movies automatically.
You first have to open the
workflow
in Automator.
Then you select the movies in Finder.
Then you click the "play" button in Automator.
Make your presentations / lectures more lively with PowerDraw
Have you ever wished to just draw a few lines on the screen during your
presentation? Or did you wish you could highlight a word or phrase or
part of a drawing during your lecture? Maybe you even wanted a few blank
slides so you could explain something in more detail?
Then
PowerDraw
is the tool for you.
It is particularly useful when giving presentations / lectures using
a ModBook
(this is a tablet MacBook).
On the right you can see a picture how it looks like
Here is an overview of the features:
- Overdraw mode: while switched on, all mouse clicks and dragging are
intercepted by
PowerDraw to create line drawings. If overdraw mode is switched off,
then only PowerDraw's buttons are active; all mouse events in other
areas of the screen go to the application underneath, as ususal.
- Two buttons for stepping forward/backward in your presentation (this is
particularly useful while overdraw mode is on).
- Buttons to skip to the next/previous slide, no matter how many
animations there are.
- The GUI is fairly minimal, so as not to
intrude too much; it is also quite efficient (hopefully),
so that switching between drawing mode and click-through mode, and
between different drawing colors is as quick as possible.
-
PowerDraw remembers what you have drawn over each slide; so if you go
back a slide, the drawings you have made there will be displayed again.
And it does not matter whether you go back via PowerDraw's button, or
via Powerpoints
own user interface (e.g., backspace, right click, etc.)
- PowerDraw
never intercepts keyboard events, so key clicks will always go to
Powerpoint (or whatever application is in focus at the moment). This is
a safety net. (Another reason is that
the ModBook has no keyboard at all.)
Installation: just download
the disk image and move the application inside
to your Applications folder.
Usage: just run PowerDraw, the rest should be straight-forward.
Prerequisites: Mac OS X 10.5 or higher and, if you want to use it with
Powerpoint, Powerpoint 2008.
Donation: if you find yourself using this app sometimes, please consider
making a donation (see the button at the bottom of the configurations
sheet); all kinds of donations will be highly appreciated!
License:
please notice that I put PowerDraw under
a copyright and license
that basically says it's free for personal use but not for commercial use.
Test program showing how to create a window that is always on top,
transparent, and still gets mouse events in Cocoa (on Mac OS X)
Because it cost me at least 2 days to find out how to create a window
under Cocoa that allows to do the following:
- a transparent window using Cocoa that is always on top of all other
windows;
- a button with which one can toggle the mouse behavior on the "glass
canvas";
- while the button is pressed, the transparent window captures mouse events;
while the button is not pressed, the window is click-through;
- the toggle button always receives mouse events.
I post this little
test program ;
here is the
single source file
again, so that (hopefully) people will find it better via google
(it is, of course, contained in the zip file, too).
It works under XCode 3.1.3 and Mac OS X 10.5 (Tiger).
Make the iPhone work with congstar
When I switched to congstar in Germany, I had the problem that it wouldn't let
me enter the parameters for the Cellular Data Network (APN, username, password)
although my iPhone did receive an EDGE signal.
I solved this with the following procedure:
-
Download this Carrier Bundle:
congstar_de.bundle.zip
and unzip it.
-
Copy it over to your iPhone:
scp -r congstar_de.bundle root@169.254.xxx.xxx:"/System/Library/Carrier\ Bundles",
where 169.254.xxx.xxx is the current IP address of you iPhone.
(I usually do this by creating a private network on my Mac.)
-
Ssh into your iPhone:
ssh root@169.254.xxx.xxx
and
cd /System/Library/Carrier\ Bundles.
-
Make the new carrier bundle the one to be used in Germany on the T-Mobile
network like so:
# mv 26201 26201_old
# mv 26206 26206_old
# ln -s congstar_de.bundle 26201
# ln -s congstar_de.bundle 26206
-
Reboot your iPhone.
And by some magic, I even got the correct internet parameters in
Settings -> General -> Network -> Cellular Data Network after the
reboot, namely
APN = internet.t-mobile , username = t-mobile ,
password = tm !
(They are not contained in the carrier bundle...)
Update: with the upgrade to firmware 2.2, I don't have the menu
'Settings -> General -> Network -> Cellular Data Network'
any more :-( , but the settings are still correct ;-)
The iPhone still doesn't show the carrier's name at the top left (next to the
signal strength), and you still get a blank carrier name in Settings ->
Carrier, where it should say D1 or T-Mobile ... but, oh well ...
I've got an iPhone 2G with firmware 2.1, jailbroken and unlocked.
I relied on a number of most valuable sources for the above procedure:
http://www.volkspost.info/carrierbundle_pwn2/
,
http://en.wikipedia.org/wiki/Mobile_network_code
,
http://hackint0sh.org/forum/showpost.php?p=274640&postcount=20
(the plutil was already installed on my Mac).
Batch Convert a Number of Movies with Quicktime
Here is a little applescript that
batch converts
a number of movies into the format that you have used last time when you
converted a movie using Quicktime.
Just unpack the
gzip file
(double-clicking should do it),
then drag a number of movies onto the icon.
A few Basic Shapes as OmniGraffle Stencil
I have imported a few shapes from Visio into OmniGraffle and created a
stencil of them.
It contains a curly brace, a number of cloud shapes, thunderbolts,
block arrows, and callout boxes.
Just download the zip file, unpack it, and move the .gstencil file into
~/Library/Application Support/OmniGraffle/Stencils.
Move Off-Screen Windows to the Main Screen
Here is a little applescript that
moves all windows
that are almost or completely off-screen
to a position on the screen (main display).
This can be very handy when you plug in your Mac laptop to different displays
(such as projector and flat panel). Then, it often happens (to me,
at least) that some windows get pushed to the very sides of the screen, so
that only a few pixels of the windows remain on-screen.
I should mention that this version is based on the script provided
by Jonathan Laliberte
Here is a little variation; the difference is:
all windows that are more or less off-screen (no matter how much) are moved back
so that they are completely on screen (if possible).
Counting Polygons in VRML / X3D
If you want to count the number of polygons in a VRML / X3D file
without a VRML loader / brwoser,
here is a little script.
Simplex Noise
Here is a port to GLUT
of Stefan Gustavson's
demo
of "simplex noise", which was invented by Ken Perlin.
My port compiles and runs fine under Mac OS X 10.4 on my Powerbook,
and it should also compile fine under Linux (please let me know).
Klausur-Auswertung
(The following text is in German, because the Excel sheet is in German, too.)
Mit diesem Excel Sheet
kann man Klausurergebnisse komfortabel auswerten, d.h., Noten erstellen und
kleine Statistiken erzeugen.
Hier sind 3 Beispiel-Snapshots:
Bsp 1,
Bsp 2,
Bsp 3 (verschiedene Ausschnitte desselben
Excel-Sheets).
Folgende Dinge berechnet das Sheet automatisch:
- Pro Student: Summe der Punkte und Note,
- Histogramm über die Gesamtpunkte,
- Histogramm über die Noten,
- Durchfallquote,
- Für jede Aufgabe ein Histogramm der erreichten Punkte,
- Farbkodierung der Noten,
- auf einem zweiten Sheet eine anonymisierte Tabelle der Noten, so
daß daraus sehr einfach eine HTML-Tabelle erzeugt werden kann;
Alle diese Dinge werden automatisch berechnet, sobald man eine der Eingaben
ändert (z.B. Punkte in einer Aufgabe, Schwellwerte, etc.).
Folgende Daten muß man eingeben:
- Pro Student: die erreichten Punkte in jeder Aufgabe;
- Je einen Schwellwert für die Note 1.0 und 4.0;
Eine kurze Anleitung und Erläuterungen sind im Excel-Sheet enthalten.
Bemerkung:
Beim Öffnen muß man "enable macros" anklicken (ansonsten funktioniert
die Aktualisierung der Farbcodes der Noten nicht; alles andere funktioniert aber
weiterhin).
Make Proceedings from many PDFs
This page
explains an easy method to produce a single PDF (such as a
proceedings) from a bunch of PDFs, such that the pages of the single PDF have
headings and consecutive page numbers.
Print Your Mac's IP
This little script prints your external
as well as your internal IP on the command line.
These two IPs might be different if you are behind a router or a NAT
device.
The script is written in Python (which is installed on your Mac).
Find Duplicate Files on the Mac
Here is a little command line tool for Mac OS
X (10.4, Tiger) that finds duplicate files in a directory tree. Just put the
binary somewhere in your PATH, e.g.,
~/bin.
Details:
Find files that are (byte-wise) identical,
but are (possibly) scattered among different directories.
This might happen, for instance, if you copy a large directory
tree and (accidentally) resolve symbolic links during the copying.
The output (on stdout) consists of two lists (mainly):
first a list of files that have been found to be equal, one file
per line, and the last file within each group of equal files
gets a period appended;
second, the list of duplicates sorted by complete pathname.
Special files, like .DS_Store, are not considered.
Also, special directories, like CVS, are skipped.
In addition, only regular files are considered,
no symbolic links or other special files.
The implementation uses a number of optimization tricks to speed up
the search. On my G4, scanning a directory tree consisting of 40,000 files
in total, containing 7,000 duplicates, took about 3 minutes.
And here is the source code as
XCode 2.4 project.
Photo Screen Saver for the Mac
ArtSaver
has a
home on its own page, now.
Convert CSV to Mail Aliases
I transfered all my contacts from my good old Revo to a Siemens CX65.
But I send my email under Linux using mutt.
So here is a little Perl script that converts a CSV file into
a file containing an email alias for each name.
Prerequisite: the Perl module Text::xSV
(see the man page perlmodinstall for installation instruction).
Gabriel Zachmann
Last modified:
Thu Jan 17 11:30:57 CET 2019