Skip to content

Instantly share code, notes, and snippets.

View jnbek's full-sized avatar

John D Jones III jnbek

View GitHub Profile
@jnbek
jnbek / gibb.pl
Created May 24, 2011 19:07
print gibberish
@a=("a".."z","A".."Z",0..9);print join "",(map{$a[rand @a]}@a)[0..(rand(100))],"\n";
@jnbek
jnbek / zsh_promptings.zsh
Created June 27, 2011 15:55
zsh prompts
SJOBS=`jobs | sed "s/ */ /g" | cut -d" " -f1,3-`
if [[ "$WINDOW" == "" ]]; then
export PS1="$SJOBS
[J:%j]%n@%m($BRAND):%d%# " # prompt string
else
export PS1="$SJOBS
[J:%j][$WINDOW]%n@%m($BRAND):%d%# " # prompt string showing screen window
fi
@jnbek
jnbek / gist:1241191
Created September 25, 2011 21:38
broken symlinks
To also show what the broken links used to point to:
find -L Documents -type l -ls
- or -
find -L Documents -type l -exec ls -l "{}" \;
- or -
find -L Documents -type l -exec ls -l –color "{}" \; ## colorized
@jnbek
jnbek / symlink_finder.zsh
Created September 28, 2011 04:00
find all symlinks in zsh
@jnbek
jnbek / installfonts.zsh
Created October 20, 2011 18:42
Install All TTF fonts in Arch repos
X=(`pacman -Ss ttf- | sed -e's/\s.*//'`); pacman -S $X
@jnbek
jnbek / r.pl
Created October 27, 2011 02:10
RSS stuff
319 $r = <<HTML;
320 <p><strong><a href="$rss->{'channel'}->{'link'}">$rss->{'channel'}->{'title'}</a></strong></p>
321 HTML
322 if ( $rss->{'image'}->{'link'} ) {
323 $r .= <<HTML;
324 <p><a href="$rss->{'image'}->{'link'}"><img title="$rss->{'image'}->{'url'}" src="$rss->{'image'}->{'url'}" alt="$rss- >{'image'}->{'title'}" style="border-style: none;"
325 HTML
326 $r .= " width=\"$rss->{'image'}->{'width'}\""
327 if $rss->{'image'}->{'width'};
328 $r .= " height=\"$rss->{'image'}->{'height'}\""
@jnbek
jnbek / 12_kde_aliases.zsh
Created November 1, 2011 21:33
kde xrandr
alias savesingle='cp ~/.kde4/share/config/plasma-desktop-appletsrc{,-singlehead}'
alias restoresingle='cp ~/.kde4/share/config/plasma-desktop-appletsrc{-singlehead,}'
alias savedual='cp ~/.kde4/share/config/plasma-desktop-appletsrc{,-dualhead}'
alias restoredual='cp ~/.kde4/share/config/plasma-desktop-appletsrc{-dualhead,}'
# These will need updating based on actual values....
alias switchsingle='restoresingle && xrandr --output DVI-0 --off && xrandr --output LVDS --mode 1440x900 --rate 60.1'
alias switchdual='restoredual && xrandr --output LVDS --off && xrandr --output DVI-0 --mode 1680x1050 --rate 59.9'
@jnbek
jnbek / gettag.pl
Created November 10, 2011 04:30
Traverse a filesystem of songs, only getting specific genres and ignoring satanic music.
#!/usr/bin/perl -w
use strict;
use warnings;
use MP3::Info;
use File::Find ();
use Data::Dumper;
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
@jnbek
jnbek / arch.zsh
Created November 11, 2011 01:05
64 bit Arch Desktop
#!/bin/zsh
# Install all the packages for my Arch Linux Installs
yaourt -Syy;
W=(`pacman -Ss gimp | grep -v help | perl -p -i -e 's/^.*\/(.*).+/$1/xs' | sed -e's/\s.*//'`);
X=(`pacman -Ss ttf- | perl -p -i -e 's/^.*\/(.*).+/$1/xs' | sed -e's/\s.*//'`);
Y=(`pacman -Ss gstreamer0.10- | perl -p -i -e 's/^.*\/(.*).+/$1/xs' | sed -e's/\s.*//'`);
PACMAN=( abs ack ati-dri audex aurvote cabextract cdrdao cifs-utils clementine clojure ctags cups customizepkg cvs dnstracer dnsutils dvd+rw-tools easytag enchant faac findutils firefox flac flashplugin fpc fuse fuseiso gdb gdm gecko-mediaplayer geoip ghostscript gimp-help-en git gprolog gramps graphviz guifications gvfs gvfs-afc gvfs-afp gvfs-gphoto2 gvfs-smb gvim htop hunspell hunspell-en icedtea-web-java7 inetutils intel-dri iputils jre7-openjdk k3b kdegraphics-okular kdesdk-kate keychain lame lazarus lib32-ati-dri lib32-intel-dri lib32-nouveau-dri libgnomeui libgpod libreoffice libreoffice-en-US lua luakit mate mate-extras mercurial mesa mlocate multilib-devel net
@jnbek
jnbek / hasProperty.js
Created November 14, 2011 17:10 — forked from ryanflorence/hasProperty.js
See if an object has a property
var has = function (obj, property) {
var tree = obj,
split = property.split('.'),
last = split.pop();
while (next = split.shift()) {
tree = tree[next];
if (tree === undefined) return false;
}