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
| { "keys": ["home"], "command": "move_to", "args": {"to": "bol"} }, | |
| { "keys": ["end"], "command": "move_to", "args": {"to": "eol"} }, | |
| { "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} }, | |
| { "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true } }, | |
| { "keys": ["ctrl+home"], "command": "move_to", "args": {"to": "bof"} }, | |
| { "keys": ["ctrl+end"], "command": "move_to", "args": {"to": "eof"} }, | |
| { "keys": ["ctrl+shift+home"], "command": "move_to", "args": {"to": "bof", "extend": true} }, | |
| { "keys": ["ctrl+shift+end"], "command": "move_to", "args": {"to": "eof", "extend": true} } | |
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
| # Note: there is also URI::join(base_path, relative_path) for URI paths | |
| # | |
| File.class_eval do | |
| # combines "some/path/here" and "../there/something?asdf=qwerty" to be: | |
| # "/some/path/there/something?asdf=qwerty" | |
| # | |
| # usage: File.combine_relative_path(base_path, relative_path) | |
| # | |
| def self.combine_relative_paths(base_path, relative_path) |
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
| from tensorflow.contrib.keras.api.keras.models import Sequential, Model | |
| from tensorflow.contrib.keras.api.keras.layers import Dense | |
| from tensorflow.contrib.keras.api.keras.optimizers import SGD | |
| import numpy as np | |
| X = np.array([[0,0],[0,1],[1,0],[1,1]]) | |
| y = np.array([[0],[0],[0],[1]]) | |
| # y = np.array([[0],[1],[1],[1]]) # The same size Network can train a logical OR | |
| model = Sequential() |
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
| import numpy as np | |
| from tensorflow.contrib.keras.api.keras.models import Sequential, Model | |
| from tensorflow.contrib.keras.api.keras.layers import Dense, Activation, Dropout | |
| from tensorflow.contrib.keras.api.keras.optimizers import SGD | |
| model = Sequential() | |
| # tanh activation allows [-1,1] | |
| model.add(Dense(6, input_dim=2, activation='tanh')) | |
| # hard_sigmoid will converge much faster than sigmoid with this example | |
| model.add(Dense(1, activation='hard_sigmoid')) |
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
| # All the files that match with 'coverage' and tell git to use the branch we're on currenthl (ours, opposed to theirs) | |
| git status | grep coverage | sed 's/.*: \(.*\)/\1/g' | xargs git checkout --ours |
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
| sed 's/\x1B\[[0-9;]*[JKmsu]//g' file_to_process > new_file |
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
| # Gist that compares different types of in-memory ruby data access | |
| require 'benchmark-ips' | |
| # The local variables | |
| asdf = "wookie" | |
| h = {asdf: "wookie"} | |
| # The Constants | |
| ASDF = "wookie" |
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
| # Must be root | |
| sudo su - | |
| vi /etc/hostname | |
| # To prevent reboot (also as root) | |
| cat /etc/hostname > /proc/sys/kernel/hostname |
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 lsof -p $MYSQL_PID | grep localhost | for x in `sed 's/.*mysql->localhost:\(.*\) .*/\1/g'`; do sudo netstat -tapen | grep "0 127.0.0.1:$x"; done | sed 's/.* \(.*\)/\1/g' | sort | uniq -c | sort -n |
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
| zgrep "END: current_user" production.log.2.gz | sed 's/\(.*\) \[.*INFO.*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\3\t\4\t\2\t\1/g' | sort -n | tail -n 20 | |
| # with process:request | |
| grep "END: current_user" production.log | sed 's/\(.*\) \[.*INFO.*\[\(.*\)\].*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\4\t\2\t\1\t\3\t\5/g' | sort -n | tail -n 100 | |
| # find with process:request, then loop back and find problems for each... | |
| # Part 1 | |
| grep "END: current_user" production.log | sed 's/\(.*\) \[.*INFO.*\[\(.*\)\].*current_user\[\(.*\)\] (\(.*\)) \(.*\)/\4\t\2\t\1\t\3\t\5/g' | sort -n | tail -n 100 > slow_requests_10_26_2015.txt | |
| # Part 2 | |
| for rqid in `cat slow_requests_10_26_2015.txt | sed 's/.*seconds\t\(.*\)\s.*2015.*/\1/g'`;do echo -e "API Calls for [$rqid]\n---------------------------\n"; grep $rqid production.log | grep "request to api.exigo.com" -A 1; echo -e "\n\n";done > exigo_slow_calls_report_10_26_2015.txt |