I hereby claim:
- I am benzado on github.
- I am benzado (https://keybase.io/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:
I hereby claim:
To claim this, I am signing this object:
#!/bin/bash | |
# "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. | |
URL=$1 |
#!/bin/sh | |
# vault-merge | |
# Benjamin Ragheb <[email protected]> | |
# 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. |
#!/usr/bin/perl | |
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? |
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. |
(* | |
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} |
(* | |
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 |