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
#!/usr/bin/ruby | |
# idea from https://gist.github.com/mattitanskane/43eb9a4b59f16ce46d2a6dbf6c02b87d | |
if ['-h','--hide'].any?{|h| h == ARGV[0]} | |
# Hide Dock | |
shell = <<~BASH | |
defaults write com.apple.dock autohide -bool true && killall Dock | |
defaults write com.apple.dock autohide-delay -float 1000 && killall Dock | |
defaults write com.apple.dock no-bouncing -bool TRUE && killall Dock | |
BASH | |
good = 'hidden' |
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
# Temporarily redirects STDOUT and STDERR to /dev/null | |
# but does print exceptions should there occur any. | |
# Call as: | |
# suppress_output { puts 'never printed' } | |
# | |
def suppress_output | |
original_stderr = $stderr.clone | |
original_stdout = $stdout.clone | |
$stderr.reopen(File.new('/dev/null', 'w')) | |
$stdout.reopen(File.new('/dev/null', 'w')) |
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
#!/usr/bin/python3 | |
import logging | |
import os | |
import subprocess | |
import sys | |
from typing import Literal | |
logging.basicConfig(level=logging.DEBUG) |
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
#!/bin/bash | |
# echoes '#!/bin/bash xdg-open "$1" &> $HOME/.xdg-open-error &' to /usr/sbin/open | |
echo -e "\043\041/bin/bash\n\nxdg-open \042\044\061\042 &> $HOME/.xdg-open-error &" > ozanmuyes-open | |
sudo mv ozanmuyes-open /usr/sbin/open | |
sudo chmod +x /usr/sbin/open | |
echo -e "\n# Mac OSX \047open\047 equivalent for Debian\nalias 'open'='/usr/sbin/open'" >> $HOME/.zshrc | |
. $HOME/.zshrc |
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
#!/bin/bash | |
TOKEN="paste slack token here" | |
bdate=$(date -d "$date -30 days" +"%Y%m%d") | |
slack-cleaner --token $TOKEN --message --channel dev --before $bdate --bot --perform --as_user --rate 0.2 --quiet | |
slack-cleaner --token $TOKEN --message --channel ci-builds --before $bdate --bot --perform --as_user --rate 0.2 --quiet | |
slack-cleaner --token $TOKEN --message --channel sentry --before $bdate --bot --perform --as_user --rate 0.2 --quiet | |
slack-cleaner --token $TOKEN --message --channel server_status --before $bdate --bot --perform --as_user --rate 0.2 --quiet |
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
#!/usr/bin/env ruby | |
# pass log filename as single argument | |
filename = ARGV[0] | |
lines = File.readlines(filename).select{|l| l =~ /call_time/} | |
puts filename | |
puts lines.map{|l| l[/\d+.\d+\b/].to_f}.reduce(&:+) |
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
#!/usr/bin/env ruby | |
unless !!`which gh | grep 'bin/gh'` | |
abort('Please run brew install github/gh/gh first. exiting now.') | |
end | |
Dir.chdir(ENV['HOME'] + '/dev/clients/thoroughcare') | |
issue_numbers = `gh issue list -s open -L 500 | grep -o '^[[:digit:]]*'`.split("\n") | |
branches = `git branch --sort=committerdate`.split("\n").map(&:strip) | |
branch_issue_numbers = branches.select{|b| b[/\/\d+/]}.map{|i| i[/\d+/]} | |
delete_issue_numbers = branch_issue_numbers.reject{|n| issue_numbers.include? n}.map(&:to_s) | |
unless delete_issue_numbers.any? |
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
# ~/.atom/snippets.cson | |
".source.ruby": | |
"Initialize": | |
prefix: "Benchmark" | |
body: "Benchmark.bm do |x|\n x.report(:a) {\t$1}\n x.report(:b) {\t$2}\nend" |
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
#!/usr/bin/env ruby | |
#Run this in the root of your local github repo to find used env vars located in .env file | |
vars = File.readlines('.env') | |
keys = vars.map{|e| e[/^\w+/]}.compact.sort | |
used_keys = keys.select{|k| !`git grep #{k}`.empty? rescue nil} | |
puts "THESE ARE USED IN THE PROJECT\n\n" | |
puts used_keys | |
puts "\nThese env vars NOT used in codebase\n\n" | |
puts keys - used_keys |
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
function injectJquery(){ | |
var script = document.createElement('script'); | |
script.src = 'https://code.jquery.com/jquery-2.2.4.min.js'; | |
script.type = 'text/javascript'; | |
script.integrity = 'sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44' | |
script.crossOrigin="anonymous" | |
document.getElementsByTagName('head')[0].appendChild(script); | |
} | |
//for more info or other versions see https://code.jquery.com/ |
NewerOlder