I hereby claim:
- I am brycesch on github.
- I am brycesch (https://keybase.io/brycesch) on keybase.
- I have a public key ASDG86SfmH1zppp8yJMGD5ITxTJMuj5bFjTp_7j244zmDgo
To claim this, I am signing this object:
# Set terminal window name to current git repo (and branch) or current directory | |
git-repo() { | |
git remote -v | grep '(fetch)' | grep -o "\/[a-z,A-Z,\_,\-]*\." | tail -1 | cut -c 2- | grep -o "[a-z,A-Z,\_,\-]*" | |
} | |
git-branch() { | |
git branch | grep \* | cut -c 3- | |
} | |
git-term() { |
module FilteredSearch | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def filtered_search(conditions, filters = {}, options = {}) | |
return [] unless self.respond_to?(:tire) or conditions.nil? | |
FilteredSearch::CustomSearch.new(self, conditions, filters, options).search | |
end | |
end |
module Tire | |
module Tasks | |
module Import | |
def bulk_import_model(index, klass, options = {}) | |
unless progress_bar(klass) | |
puts "[IMPORT] Importing '#{klass.to_s}'" | |
end | |
klass.scoped.find_in_batches(options) do |batch| | |
documents = batch.map(&:to_indexed_json) | |
progress_bar(klass).inc documents.size if progress_bar(klass) |
/** | |
* Example of using an angular provider to build an api service. | |
* @author Jeremy Elbourn ([email protected]) | |
*/ | |
/** Namespace for the application. */ | |
var app = {}; | |
/******************************************************************************/ |
module_name = ARGV[0] | |
return "No module name given" unless module_name | |
files = Dir['/**/*.rb'] | |
files.each do |f| | |
f = File.open(f, "r+") | |
lines = f.readlines | |
f.close | |
output = File.new(f, "w") | |
output.write "module #{module_name}\n" |
def redirect_to(options = {}, response_status = {}) | |
::Rails.logger.error("Redirected by #{caller(1).first rescue "unknown"}") | |
super(options, response_status) | |
end |
#!/bin/bash | |
# Do the following to create the pub.pem | |
# openssl rsa -in id_rsa -outform pem > id_rsa.pem | |
# openssl rsa -in id_rsa -pubout -outform pem > id_rsa.pub.pem | |
# gen rand key | |
openssl rand -base64 32 > key.bin | |
# timestamp for dump |
class MysqlStringSanitizer | |
def self.sanitize(str) | |
str = str.force_encoding('utf-8').encode | |
clean_text = "" | |
# emoticons 1F601 - 1F64F | |
regex = /[\u{1f600}-\u{1f64f}]/ | |
clean_text = str.gsub regex, '' | |
#dingbats 2702 - 27B0 |
I hereby claim:
To claim this, I am signing this object:
#!/bin/bash | |
# chmod a+x tails.sh | |
# nohup ./tails.sh foobar.log webhook_url & | |
# use nohup if you want the cammand to persist after your session ends | |
# | |
# slack | |
tail -n0 -F "$1" | while read LINE; do | |
(echo "$LINE" | grep -e "$3") && curl -X POST --silent --data-urlencode \ | |
"payload={\"text\": \"$(echo $LINE | sed "s/\"/'/g")\"}" "$2"; | |
done |