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
for t in `grep "Finished:" log/production.log | sed 's/.*]: \(.*\)s/\1/g' | sort -n | tail -n 20`; do grep $t log/production.log; done | sed 's/\(.*\) INFO.*Finished: \(.*\)/\1 \2/g' |
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
# Backstory - I had accidentally deleted /usr/local/mysql/data/mysql.ibd and | |
# as a result lost all schema information for all dbs... | |
# | |
# 1) move the db data folder someplace safe: | |
mv /usr/local/mysql/data/my_rails_db /backups/my_rails_db | |
# 2) recreate the db with the rails app and create the same (empty) schema | |
rake db:create | |
rake db:migrate |
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
"the only thing we have to fear is fear itself", | |
"get busy living or get busy dying", | |
"those who dare to fail miserably can achieve greatly", | |
"it is hard to fail , but it is worse never to have tried to succeed", | |
"love is a serious mental disease", | |
"remember that the happiest people are not those getting more but those giving more", | |
"the opposite of love is not hate , it is indifference", | |
"life is trying things to see if they work", | |
"the quick brown fox jumped over the lazy dog", | |
"you will face many defeats in life but , never let yourself be defeated", |
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
$: (Dollar Colon) is basically a shorthand version of $LOAD_PATH. $: contains an array of paths that your script will search through when using require. | |
$0 (Dollar Zero) contains the name of the ruby program being run. This is typically the script name. | |
$* (Dollar Splat) is basically shorthand for ARGV. $* contains the command line arguments that were passed to the script. | |
$? (Dollar Question Mark) returns the exit status of the last child process to finish. | |
$$ (Dollar Dollar) returns the process number of the program currently being ran. | |
$~ (Dollar Tilde) contains the MatchData from the previous successful pattern match. | |
$1, $2, $3, $4 etc represent the content of the previous successful pattern match. | |
$& (Dollar Ampersand) contains the matched string from the previous successful pattern match. | |
$+ (Dollar Plus) contains the last match from the previous successful pattern match. | |
$` (Dollar Backtick) contains the string before the actual matched string of the previous successful pattern match. |
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
for ip in `nslookup 7-review-feature-ch-m7rnev.review.verisys.com | grep -v "#" | grep "Address:" | sed 's/.*: \(.*\)/\1/g'`;do echo $ip; ping -c 3 $ip | grep time; done |
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
# Program to display a frequency histogram of rational values | |
# determined by month divided by day values over the course of the next year | |
# For example, March 30 is 3/30 = 0.1 | |
require 'active_support/all' | |
vals = (0...365).map{|x| d = x.days.from_now; [d.strftime("%m/%d"), d.strftime("%m").to_f / d.strftime("%d").to_f]} | |
# print the results | |
# vals.each{|v| puts "#{v[0]} #{v[1]}"};nil | |
counts = Hash.new(0); vals.each{|v| counts[v[1]] += 1} | |
counts.sort{|a,b| b[1] <=> a[1]}.each{|val, count| puts "#{count} ==> #{val}"};nil |
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
# Build an informative list of all Gems used by the project - this will take a minute to run | |
echo "Calling 'gem info' for every gem in the project...patience is a virtue..." | |
for gem in `bundle list | sed 's/ \* \(.*\) (.*/\1/g' | grep -v " "` | |
do echo "--------------------------------------------------------------------" | |
gem info $gem | grep -v "Installed at" | |
done | tee gem_info.txt | |
echo "Building License Counts" | |
echo "#---#---#---#---#---#---#---#---#---#---#---#---#---#---#" | tee -a gem_info.txt | |
echo " Licenses " | tee -a gem_info.txt |
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
<html> | |
<body> | |
<canvas id="myCanvas" width="1500" height="1100" style="border: 1px solid black;"></canvas> | |
</body> | |
<script> | |
var canvas = document.getElementById("myCanvas"); | |
var canvasWidth = canvas.width; | |
var canvasHeight = canvas.height; | |
var ctx = canvas.getContext("2d"); | |
var canvasData = ctx.getImageData(0, 0, canvasWidth, canvasHeight); |
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
for f in `find . -iname "*.rb" | xargs grep "Searchflow\.call" | sed 's/\(.*.rb\):.*/\1/g' | uniq`; do echo -e "\n\n------------------- $f -------------------------";git blame $f | grep "Searchflow\.call" | sed 's/.*(\(.*\).*\(201.-..-..\).*\(Searchflow.call(api_alias:.*\), payload.*/\1 \2 \3/g'; done |
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
for year in `seq 2017 2019`; do for month in `seq -f "%02g" 1 12`;do echo -n "$year$month";find db/migrate -iname "*.rb" | grep "/$year$month" | wc -l; done; done |