Skip to content

Instantly share code, notes, and snippets.

@travist
travist / gist:1648952
Created January 20, 2012 18:45
Determine how productive your team has been using git history.
git log --shortstat --since="1 year ago" --until="now" \
| grep "files changed\|Author\|Merge:" \
| awk '{ \
if ($1 == "Author:") {\
currentUser = $2;\
}\
if ($2 == "files") {\
files[currentUser]+=$1;\
inserted[currentUser]+=$4;\
deleted[currentUser]+=$6;\
@scottalan
scottalan / gist:1663369
Created January 23, 2012 14:20
cat pub key through ssh
ssh [email protected] 'echo '`cat ~/.ssh/id_rsa.pub`' >> ~/.ssh/authorized_keys
@travist
travist / gist:1672594
Created January 24, 2012 20:59
Determine all commits for a developer given a time range.
git log --shortstat --since="2011-9-1" --until="2011-11-15" \
| grep "commit\|Author\|Merge:" \
| awk '{\
if ($1 == "Merge:") {\
merge = 1;\
}\
if ($1 == "commit") {\
merge = 0;\
commit = $2;\
}\
@travist
travist / gist:1677353
Created January 25, 2012 17:09
Determine the diff provided a Story ID.
git log\
| grep "Merge pull request.*{INSERT STORY ID HERE}" -B 5\
| awk '{\
if ($1=="commit") {\
print system("git diff " $2 "^ " $2);\
}\
}'
@christianchristensen
christianchristensen / gist:1759543
Created February 7, 2012 12:49
OpenVPN CLI notes
## Quick Setup
sudo apt-get install byobu
sudo apt-get install htop
sudo apt-get install openvpn
# sudo apt-get install bitlbee
sudo apt-get install irssi
# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
<?php
function test($x, $y, $z) {
var_dump(($x || $y) && ($z || $y));
var_dump(($x && $z) || $y);
}
test(TRUE, TRUE, TRUE);
test(TRUE, FALSE, TRUE);
test(TRUE, TRUE, FALSE);
test(FALSE, FALSE, TRUE);
@travist
travist / gist:2562314
Created April 30, 2012 20:10
Warning: remote port forwarding failed for listen port 9000
Do the following to fix this error.
ttidwell@a:~:->$ sudo lsof|grep 9000
sshd 31533 ttidwell 9u IPv6 506614 0t0 TCP [::1]:9000 (LISTEN)
sshd 31533 ttidwell 10u IPv4 506615 0t0 TCP localhost:9000 (LISTEN)
ttidwell@a:~:->$ kill 31533
@CashWilliams
CashWilliams / fix_prefix.php
Created June 29, 2012 02:28
Drupal 7 drush script to remove database prefix
<?php
// current table prefix to be removed
$prefix = "drup_";
// echo generated statments rather then run them
$pretend = FALSE;
/////////////////////////////////////////////////////////////////////
$table_list = db_query("SHOW TABLES");
@crittermike
crittermike / gist:3503791
Last active February 2, 2019 20:11
Import gzipped MySQL DB dump but ignore data from specific tables
# REGULAR VERSION
gunzip -c db.sql.gz | grep -Ev "^INSERT INTO \`(cache_|search_|sessions|whatever)" | mysql -u root -p databasename
# DRUPAL VERSION
gunzip -c db.sql.gz | grep -Ev "^INSERT INTO \`(cache_|search_|sessions|whatever)" | drush sqlc
@benclark
benclark / gist:4667006
Created January 29, 2013 19:37
Mobile detection in .htaccess file
###
# BEGIN MOBILE REDIRECTS
###
# If the skipMobileDetection cookie is set, and we're on the mobile domain,
# return to the normal domain. Do this only for SSL as Varnish will handle
# for port 80.
RewriteCond %{HTTP_COOKIE} skipmobiledetection [NC]
RewriteCond %{HTTP_HOST} ^m\. [NC]
RewriteCond %{SERVER_PORT} =443