Skip to content

Instantly share code, notes, and snippets.

View samdfonseca's full-sized avatar

Sam Fonseca samdfonseca

View GitHub Profile
@samdfonseca
samdfonseca / adbd.sh
Created June 4, 2015 23:01
Make adb easier with multiple devices
#!/bin/sh
_adbd () {
if [ "$1" ]
then
devices=(${=$(_adbdevices $1)})
if [ "$devices[2]" ]
then
echo "Matched multiple devices. Please specify search."
for device in $devices
@samdfonseca
samdfonseca / git-outdated.sh
Created January 3, 2016 17:15
update all repos in a directory at once
#!/usr/bin/env bash
readonly ARGS=$@
readonly LOG=$([ "$VERBOSE" = 1 ] && echo /dev/stdout || echo /dev/null)
readonly ERR=$([ "$VERBOSE" = 1 ] && echo /dev/stderr || echo /dev/null)
_check_repo_for_updates() {
local action=$1; shift
local nofetch=$1; shift
local repo=$1; shift

Keybase proof

I hereby claim:

  • I am samdfonseca on github.
  • I am samdfonseca (https://keybase.io/samdfonseca) on keybase.
  • I have a public key ASA8ObV3rnt14hi6CJ5fZZFBqcpwjsrAdlkf51Uu2ZAIoQo

To claim this, I am signing this object:

function virtualenv_prompt_info {
if [ $VIRTUAL_ENV ]; then
echo "($(basename $VIRTUAL_ENV)) "
fi
}
PROMPT='%{$fg[blue]%}$(virtualenv_prompt_info)%{$fg[green]%}%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
let blacklists = [
\ "https://cloud.digitalocean.com/droplets/.*/console.*",
\ "https://tools.crowdtwist.com/issues/*",
\ "*://mail.google.com/mail/*
\ ]
samlenovoubuntu: /opt/internalhd/sam/dev/git/dingo-webui |master S:2 U:10 ?:6 ✗|
→ npm search pouchdb
<--- Last few GCs --->
43907 ms: Mark-sweep 829.0 (1202.6) -> 826.5 (1209.6) MB, 1524.8 / 0 ms (+ 386.1 ms in 667 steps since start of marking, biggest step 38.7 ms) [allocation failure] [GC in old space requested].
46080 ms: Mark-sweep 826.5 (1209.6) -> 800.6 (1191.6) MB, 2173.3 / 0 ms [allocation failure] [GC in old space requested].
49151 ms: Mark-sweep 800.6 (1191.6) -> 800.6 (1182.6) MB, 3070.8 / 0 ms [last resort gc].
52007 ms: Mark-sweep 800.6 (1182.6) -> 800.5 (1176.6) MB, 2855.7 / 0 ms [last resort gc].
@samdfonseca
samdfonseca / whitelist_ssl_certificate.sh
Last active October 18, 2016 16:19
Whitelist self-signed certs on OS X
#!/usr/bin/env bash -e
SERVERNAME=$(echo "$1" | sed -E -e 's/https?:\/\///' -e 's/\/.*//')
echo "$SERVERNAME"
if [[ "$SERVERNAME" =~ .*\..* ]]; then
echo "Adding certificate for $SERVERNAME"
echo -n | openssl s_client -connect $SERVERNAME:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | tee /tmp/$SERVERNAME.cert
sudo security add-trusted-cert -d -r trustRoot -k "$HOME/Library/Keychains/login.keychain" /tmp/$SERVERNAME.cert
else
@samdfonseca
samdfonseca / README.md
Last active August 16, 2016 22:04
tpg-mock-api

tpg-mock-api is a mock server for the TPG DRVS API for testing specific scenarios. You specify the phase1 response data, and phase2 request data through the img field on the initial request. See success.jpg and error.jpg for examples.

@samdfonseca
samdfonseca / Taskfile.template
Last active November 13, 2016 08:19
This repository contains the default Taskfile template for getting started in your own projects. A Taskfile is a bash (or zsh etc.) script that follows a specific format. It's called Taskfile, sits in the root of your project and contains the tasks to build your project.
#!/usr/bin/env bash
# Quick start with the default Taskfile template
# alias run-init="curl -so Taskfile https://gist.githubusercontent.com/samdfonseca/022a8a21daf23ec1d7781812d9d91104/raw/d2f6dfaaf0a9e72852f7a3b31d22998b445ef0bb/Taskfile.template && chmod +x Taskfile"
# Run your tasks like: run <task>
# alias run=./Taskfile
PATH=./node_modules/.bin:$PATH
@samdfonseca
samdfonseca / restart.sh
Created December 26, 2017 06:02
Ubuntu 16.04 WiFi Restarter
#!/bin/sh
LOGFILE=$(dirname $BASH_SOURCE)/restart-$(date +'%m-%d-%Y').log
echo_log() {
local msg=$1
echo "[$(date +'%m-%d-%Y %T')] - $msg" | tee -a $LOGFILE
}