This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom commands | |
bind generic <Ctrl-A> !git commit --amend | |
# Custom commands in tig status, works after pressing key on selected file from list | |
bind generic i !git add -p %(file) | |
# Custom commands in tig, works after pressing key on selected commit from list | |
bind generic f !git commit --fixup=%(commit) | |
bind generic <Ctrl-H> !@sh -c "echo -n %(commit) | xclip -selection primary" # copy commit hash into primary clipboard |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set $utm_hash ""; | |
if ($args ~* "^(.*&?)utm_source=([a-zA-Z0-9._-]*)(&(.*))?") { | |
set $args $1$4; | |
set $utm_hash "$utm_hash&utm_source=$2"; | |
} | |
if ($args ~* "^(.*&?)utm_medium=([a-zA-Z0-9._-]*)(&(.*))?") { | |
set $args $1$4; | |
set $utm_hash "$utm_hash&utm_medium=$2"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
echo "usage: $0 <prefix>" | |
exit -1 | |
fi | |
redis-cli EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 $1:* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE campaign_item | |
CROSS JOIN (SELECT @sort_order := 0, SET @campaign := 0) | |
SET sort_order = (@sort_order := IF(campaign_id = @campaign, @sort_order, (@campaign := campaign_id) - campaign_id) + 1) | |
ORDER BY campaign_id, sort_order, id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash PS1 for Git repositories showing branch and relative path inside | |
# the Repository | |
# Reset | |
RESET="\[\033[0m\]" | |
# Regular Colors | |
BLACK="\[\033[0;30m\]" | |
RED="\[\033[0;31m\]" | |
GREEN="\[\033[0;32m\]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git checkout master | |
for b in $(git branch | grep -v master); do git branch -d $b; done | |
git fetch -p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX temp log | |
sudo setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX temp log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QuickSorter[T <% Ordered[T]] { | |
def sort(list: List[T]) : List[T] = { | |
list match { | |
case Nil => Nil | |
case pivot :: rest => | |
val (smaller, higher) = rest.partition(_ < pivot) | |
sort(smaller) ++ (pivot :: sort(higher)) | |
} | |
} | |
} |