Skip to content

Instantly share code, notes, and snippets.

View GregGallant's full-sized avatar
🌎
Building...

Greg Gallant GregGallant

🌎
Building...
View GitHub Profile
@GregGallant
GregGallant / gist:19fff777e4fa2f19bef0184eb248329b
Last active June 9, 2020 18:57
Benchmarking Curl Requests (100x example)
#!/bin/sh
echo "time_connect \t time_appconnect \t time_pretransfer \t time_starttransfer\n"
# Run 100 times
for i in `seq 1 100`; do curl -H "Authorization: Bearer 1234" -s -o /dev/null -w '%{time_connect}, %{time_appconnect}, %{time_pretransfer}, %{time_starttransfer}\n' "https://mgmt.auth.sample.com/esm/v2.1/media-company/year/month?media-company=Discovery&requestor-id=&proxy=&mvpd=Comcast"; done
@GregGallant
GregGallant / gist:4e1b1ae19e4e64a150e1
Last active November 4, 2015 14:18
Check status of port 9000 on MacOSX
testing ports...
sudo lsof -i :9000
netstat -Aa | grep 9000
@GregGallant
GregGallant / gist:23fc7dbc746c7168c9c0
Created June 2, 2015 15:51
Listen on a port on a shitty cult system (MacOSX)
sudo lsof -n iTCP:<port_number>
@GregGallant
GregGallant / i <3 Factorials
Last active August 29, 2015 14:22
I love factorials
// A Factorial in C++
#include <iostream>
using namespace std;
long factorial (long fac)
{
if (fac > 1)
return (fac * factorial (fac-1));
else
return 1;
@GregGallant
GregGallant / Yii2 Composer init
Created May 21, 2015 18:23
Yii2 Composer initializer
composer global require "fxp/composer-asset-plugin:1.0.0-beta3"
@GregGallant
GregGallant / Debian LAMP
Created May 20, 2015 06:03
Debian PHP5.4+ Forgetful things
sudo apt-get install libapache2-mod-php5
sudo apt-get install libcurl3 (-f)
sudo apt-get install libapache2-mod-mysql
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
@GregGallant
GregGallant / Remote Diff
Created April 23, 2015 16:55
Diff remote file with local file
ssh user@host cat /path/to/remotefile | diff /path/to/localfile -
@GregGallant
GregGallant / gist:3d4899bbb25cfbc4f227
Created February 19, 2015 16:23
Git/Github History Removal Services
git filter-branch --prune-empty -d /dev/shm/scratch --index-filter "git rm --cached -f --ignore-unmatch <filename>" --tag-name-filter cat -- --all
@GregGallant
GregGallant / Go on... git!
Last active July 22, 2016 16:13
Git in your Prompt
function parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
@GregGallant
GregGallant / memcache flush
Created September 30, 2014 16:32
I can never remember this...
echo 'flush_all' | nc localhost 11211