Skip to content

Instantly share code, notes, and snippets.

View agargiulo's full-sized avatar

Anthony Gargiulo agargiulo

View GitHub Profile
@agargiulo
agargiulo / update_rc_files
Created July 11, 2011 04:21
simple zsh script to move rc files around in home directory/repo
#!/bin/zsh
# go to $HOME
cd ~
# look for all .*rc files
for rc in \.*rc;
do;
# $rc2 = filename without the leading .
rc2=${rc:e}
@agargiulo
agargiulo / stuffs.zsh
Created August 9, 2011 19:40
simple zsh script
#!/bin/zsh
emulate -L zsh
setopt err_exit
if [[ $# -ne 1 ]]; then
printf "Usage: %s session_name\n" "$0" >&2
exit 1
fi
readonly SOCKDIR="/var/run/screen/S-${USER}"
@agargiulo
agargiulo / example1.pl
Created August 19, 2011 20:27
failing perl script section
use 5.010;
open(my $config, ">" "$configfile") or die $!;
$output = $row->{value};
my @output = split(/\n/, $output);
if ($wroteToFile)
{
foreach (@output)
{
@agargiulo
agargiulo / fad.in
Created January 2, 2012 08:36
stupid note fad thing
question 1
question 2
#!/bin/zsh
#
echo wget -O CentOS/initrd_6_32.img "http://mirrors.rit.edu/centos/6.2/os/i386/images/pxeboot/initrd.img"
wget -O CentOS/initrd_6_32.img "http://mirrors.rit.edu/centos/6.2/os/i386/images/pxeboot/initrd.img"
echo wget -O CentOS/initrd_6_64.img "http://mirrors.rit.edu/centos/6.2/os/x86_64/images/pxeboot/initrd.img"
wget -O CentOS/initrd_6_64.img "http://mirrors.rit.edu/centos/6.2/os/x86_64/images/pxeboot/initrd.img"
echo wget -O CentOS/vmlinuz_6_32 "http://mirrors.rit.edu/centos/6.2/os/i386/images/pxeboot/vmlinuz"
wget -O CentOS/vmlinuz_6_32 "http://mirrors.rit.edu/centos/6.2/os/i386/images/pxeboot/vmlinuz"
echo wget -O CentOS/vmlinuz_6_64 "http://mirrors.rit.edu/centos/6.2/os/x86_64/images/pxeboot/vmlinuz"
wget -O CentOS/vmlinuz_6_64 "http://mirrors.rit.edu/centos/6.2/os/x86_64/images/pxeboot/vmlinuz"
@agargiulo
agargiulo / output.s
Created February 1, 2013 18:02
Some interesting output from GCC and Clang with different sections of the same source file from my latest sys prog project
# From GCC 4.6.3
movl GLOBAL_TIME, %eax
addl $1, %eax
movl %eax, GLOBAL_TIME
movl GLOBAL_TIME, %eax
# From Clang 3.0-6ubuntu
movl ALARM_TIME, %eax
cmpl GLOBAL_TIME, %eax
jne .LBB0_5
@agargiulo
agargiulo / boto.zsh
Last active December 18, 2015 15:58 — forked from anonymous/boto.zsh
setopt extendedglob
typeset -a boto_web_envs
for cfg in `echo ~/.botocfg/(*~*.aws.cfg)`;do
boto_web_envs+="${cfg:t:r}"
done
benv(){
if [[ "$1" == "" ]];
then
print "Usage: $0 env-name\n" >&2
ZKBD_FILE=${HOME}/.zkbd/$TERM-$VENDOR-$OSTYPE
if [[ -e $ZKBD_FILE ]]
then
source $ZKBD_FILE
else
autoload zkbd
zkbd
source $ZKBD_FILE
fi
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
#!/usr/bin/zsh
for and_target in `print -l ${ANDROID_TARGET} `;do
android update project -p . --subprojects -t ${and_target} -n GatekeeperAndroid
ant debug
done
@agargiulo
agargiulo / diff.zsh
Last active August 29, 2015 14:06
Floating point fun
#!/usr/bin/zsh
money=103.4
print "ruby vs python:"
diff <(echo $money | ruby ex12b.rb) <(echo $money | python3 ex12b.py) && print "No changes"
print "ruby vs java:"
diff <(echo $money | ruby ex12b.rb) <(echo $money | java ex12b) && print "No changes"