Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Tony Gaetani tonygaetani

🏠
Working from home
Block or report user

Report or block tonygaetani

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View docker-clean-all.bash
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
# thank you https://coderwall.com/p/ewk0mq/stop-remove-all-docker-containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
@tonygaetani
tonygaetani / keybase.md
Created Jul 26, 2016
github keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am tonygaetani on github.
  • I am tonygaetani (https://keybase.io/tonygaetani) on keybase.
  • I have a public key whose fingerprint is 984C EC21 2057 94EF D296 AD3F 436F D09B AD04 F349

To claim this, I am signing this object:

View .basic.vimrc
" show syntax highlighting
syntax enable
" dark theme just like my heart
set background=dark
" show line numbers
set number
" re-enable backspace usage
set backspace=2
set backspace=indent,eol,start
" use 4 space charachters for indentation
@tonygaetani
tonygaetani / concurrentexample.py
Last active Apr 8, 2017
an example of concurrent.futures.ProcessPoolExecutor for python 2.7
View concurrentexample.py
import concurrent.futures
import time
def sleep_print_return(input):
print "{} started".format(input)
time.sleep(input % 3)
return input
def main():
# to observe the difference, change max_workers to 1
View build-each-commit.bash
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
HEAD=$(git rev-parse --abbrev-ref HEAD)
if [[ "${HEAD}" == "HEAD" ]]; then
HEAD=$(git rev-parse HEAD)
fi
STASH=0
if [[ -n $(git status --porcelain) ]]; then
@tonygaetani
tonygaetani / swapmem.sh
Created Jan 29, 2016
Vagrant/Linux increase swap memory
View swapmem.sh
#!/bin/sh
# Thank you to Jorge Quilcate Otoya for this helpful script
# https://jeqo.github.io/blog/devops/vagrant-quickstart/
# size of swapfile in megabytes
swapsize=8000
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
@tonygaetani
tonygaetani / argparseissue.py
Last active Jan 27, 2016
Potential argparse issue?
View argparseissue.py
#!/usr/bin/env python
# mac OSX 10.10.3
# python 2.7.10 (installed with homebrew)
# argparse 1.4.0
# to test - `python argparseissue.py --help`
# expected -
# usage: issue.py [-h] -f FOO [-b BAR]
View .basic.tmux.conf
# increased buffer size
set-option -g history-limit 5000
# shell
SHELL=bash
set-option -g default-shell /bin/$SHELL
# no delay for escape key press
set -sg escape-time 0
@tonygaetani
tonygaetani / Vagrantfile
Last active Jan 22, 2016 — forked from leifg/Vagrantfile
Add a second disk to system using vagrant
View Vagrantfile
config.vm.provider "virtualbox" do |v|
file_to_disk = './tmp/large_disk.vdi'
unless File.exist?(file_to_disk)
v.customize ['createhd', '--filename', file_to_disk, '--size', 500] # size is in MB
end
v.customize ['storageattach', :id, '--storagectl', 'SATAController', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
View binconv.clj
(defn pow2 [n]
"Returns a long representing 2^n"
(->> n (Math/pow 2) long))
(defn b10->b2
"Converts a base 10 number to a lazy seq of 1's and 0's that make up a base 2 number"
([n] (b10->b2 n '()))
([n col]
(if (= 1 n)
(merge col 1) ; base case
You can’t perform that action at this time.