Skip to content

Instantly share code, notes, and snippets.

LogCheckkin' across the universe...

Benjamin Ragheb benzado

LogCheckkin' across the universe...
Block or report user

Report or block benzado

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am benzado on github.
  • I am benzado ( on keybase.
  • I have a public key whose fingerprint is 03D5 56A6 7526 6DDB 9758 C334 B706 4956 8B45 522F

To claim this, I am signing this object:

# "ping" a server by making a HTTP request once every 1-2 seconds. It waits
# for the server to stop responding, then prints the current time, then waits
# for the server to respond again, then prints the time and quits.
# I wrote this to measure downtime during a reboot against a server that did
# could not respond to ICMP (ping) messages.
benzado /
Last active Feb 24, 2017
A shell script for merging encrypted Ansible vault files in a git repository
# vault-merge
# Benjamin Ragheb <>
# This shell script handles conflicts generated by attempts to merge encrypted
# Ansible Vault files. Run `git merge` as usual; when git warns of a merge
# conflict, run this command to attempt a merge on the unencrypted versions of
# the file. If there are conflicts, you will be given a chance to correct them
# in $EDITOR.
benzado /
Created Sep 15, 2011
Remove duplicates (for Mac Downloads folder)
my @FILES = glob('*');
my $X = shift @FILES;
my @Xstat = stat($X);
my $Xesc = $X; $Xesc =~ s/([^a-zA-Z0-9])/\\$1/g;
FILE: foreach my $Y (@FILES) {
my @Ystat = stat($Y);
$Yesc = $Y; $Yesc =~ s/([^a-zA-Z0-9])/\\$1/g;
if ($Xstat[7] == $Ystat[7]) { # files same size?
benzado / README
Created Sep 1, 2011
Convert a Google form response spreadsheet into a readable text file
I first tried to use sqlite's ability to import a file into a table, but ran
into a problem: if any line in the source file didn't have the same number of
columns as the table, the import would fail. For example, if your 10 question
survey ends with a comment field and a respondent left it blank, that line will
have 9 columns instead of 10 and the import will fail.
Next I tried to use a combination of command line tools like `cut` and `paste`,
but couldn't figure out anything that was reasonable. So I gave up and wrote a
perl script, which is fine, because this is what perl is good at.
View Optimize PNG Files.applescript
Runs optipng command line tool on any selected image files.
property optipng : "/opt/local/bin/optipng"
tell application "Finder"
set _selection to (selection)
set _images to {}
repeat with _item in _selection
if kind of _item ends with "image" then set _images to _images & {_item}
benzado / Archive Messages.applescript
Created Jul 25, 2011
Archive Messages (AppleScript for Mac Mail)
View Archive Messages.applescript
Moves selected messages into an archive folder. I use FastScripts to bind this to Shift-Cmd-A.
For Gmail accounts, moves messages into "[Gmail]/All Mail"; for all other accounts, looks for a mailbox named "Archive".
Tested with Mail 4.5 (Mac OS X 10.6 Snow Leopard).
tell application "Mail"
tell front message viewer
You can’t perform that action at this time.