This file contains 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
Replace all instances of old_string with new_string recursively within the current directory and its sub-directories: | |
grep -rl old_string * | xargs sed -i '' 's/old_string/new_string/g' | |
Sum all numbers in your file (assuming that the numbers are the first column, one per line): | |
awk '{s+=$1} END {print s}' $filename | |
This file contains 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
first_commit=$(git log --pretty=format:%H | tail -1) | |
git rev-list --all --no-merges | | |
while read commit; do | |
if [ $commit == $first_commit ]; then break; fi; | |
IFS_backup=$IFS | |
IFS=$'\n' | |
diff_lines=( $(git diff --numstat --minimal -U0 --word-diff=porcelain $commit^ $commit | grep -E '^(\+[^+]|-[^-]).*$') ) | |
IFS=$IFS_backup |
This file contains 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
Those links in Jira are really hard to see! Not differentiated by color or underline, yeesh. | |
This Chrome extension solves that problem by simply adding !important background css to make | |
all links on your Jira site bright orange and underlined. | |
To use, just clone this gist and change the links in manifest.json line 11 to match the URL(s) | |
for your Jira installation. Then go your extension manager and click "Load unpacked extension" | |
to select the directory and get it running. (If you don't see the link near the top left, check | |
"developer mode" and it will show up.) Problem solved. |
This file contains 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
def insert_branch(branch) | |
@encoded.each_with_index do |node, i| | |
if branch[-1] <= node[-1] | |
@encoded.insert i, branch | |
return @encoded | |
end | |
end | |
@encoded.push(branch) | |
end |
This file contains 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
# Kosaraju's algorithm for detecting strongly connected components | |
# (iterative version because the Ruby stack is sad) | |
$:.unshift File.expand_path('.') | |
require 'pp' | |
require 'set' | |
@t = 0 #finishing time | |
@explored = Set.new [] |
This file contains 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
# import gevent | |
# import gevent.socket as socket | |
# import gevent.ssl as ssl | |
# from gevent import spawn | |
import socket | |
import ssl | |
import pprint | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
NewerOlder