Skip to content

Instantly share code, notes, and snippets.

@sirhc
Last active September 25, 2015 19:28
Show Gist options
  • Save sirhc/972589 to your computer and use it in GitHub Desktop.
Save sirhc/972589 to your computer and use it in GitHub Desktop.
Shell one liners
#!/bin/sh
# Generate a relatively secure password.
apg -n 10 -m 8 -x 8 -t -a0 -MNCl
perl -Mutf8 -MConvert::Braille -e 'print brailleUnicodeToAscii("⠚⠥⠎⠞ ⠁⠝⠕⠞⠓⠑⠗ ⠷⠃⠇⠊⠝⠙⠾ ⠏⠑⠗⠇ ⠓⠁⠉⠅⠑⠗")'
# Convert a 16:9 720p .mkv file to a 4:3 .avi file.
mencoder $file1.mkv -oac mp3lame -ovc xvid -xvidencopts pass=1 \
-vf scale=720:352 -o $file2.avi
perl -MDevel::Symdump -E 'say for Devel::Symdump->new("Devel::Symdump")->functions'
perl -MAcme::POE::Tree -e 'Acme::POE::Tree->new()->run()'
alias bofh="nc bofh.jeffballard.us 666 | sed -ne 's/[^:]*: //p';:"
display <(perl -MImage::Grab -e'print Image::Grab->new(SEARCH_URL,"http://dilbert.com/strips/comic/2010-01-20",REGEXP,"strip.gif")->grab')
df -hP | awk 'NR==1;NR>1{print|"sort -k5rn"}'; # sort the output of df while keeping the header at the top
# Fix time zones in files imported from WordPress using exitwp:
perl -MDateTime::Format::ISO8601 -i -nE '/^date: (\d+-\d+-\d+) (\d+:\d+:\d+)/ ? do { $dt = DateTime::Format::ISO8601->parse_datetime("$1T$2"); $dt->set_time_zone("America/Los_Angeles"); say "date: $dt", $dt->is_dst ? "-07:00" : "-08:00" } : print' source/_posts/*.markdown
# Create an archive of files changed between two commits.
# (https://twitter.com/climagic/status/400284722695110656)
tar cvzf diff.tar.gz $( git diff --name-only [commit1] [commit2] )
# Find Git repositories without a remote configured.
find . -type d -name .git -exec sh -c 'cd $(dirname {}) && test -z "$(git remote)" && pwd' \;
#!/usr/bin/env perl
# Can Gist include a second file?
@RevChas
Copy link

RevChas commented Jul 29, 2013

Apparently so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment