Skip to content

Instantly share code, notes, and snippets.

View agargiulo's full-sized avatar

Anthony Gargiulo agargiulo

View GitHub Profile
@agargiulo
agargiulo / .gitconfig
Last active March 3, 2023 07:57
my git config, more or less
[user]
name = Person Name
email = you_rock@example.com
# I love Vim. Vimdiff is amazing. This combined with `merge.conflictstyle = diff3`
# makes for fun 4 pane vim sessions that make merge headaches almost all go away
[diff]
tool = vimdiff
compactionHeuristic = true
@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}"
function ssl_dates () {
local rem_host="${1}"
local rem_port="${2:-443}"
[[ -n $rem_host ]] || {
echo 'USAGE: ssl_dates host.example.com [8443]' && return 1
}
echo '' | openssl s_client -servername "${rem_host}" -showcerts -connect "${rem_host}:${rem_port}" | openssl x509 -noout -dates
}
@agargiulo
agargiulo / project_switcher.zsh
Last active January 2, 2019 23:30
Wanted a way to navigate between different projects using only zsh. Feedback welcome
setopt extendedglob
unset CURRENT_PROJECT_NAME
typeset -a project_dirs
find "${HOME}/projects" -maxdepth 1 -type d | while read project; do
project_dirs+=("${project:t}")
done
function proj() {
name=$1
base=${2-projects}
@agargiulo
agargiulo / heron.c
Last active October 3, 2016 20:17
Heron square root implementations in a few languages.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
double heron_sqrt(long n, double percision);
void compare_sqrt(long n);
int main(int argc, char **argv)
{
#!/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
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
@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
@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
#!/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"