View gist:8850823
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
Sidekiq.logger.formatter = proc do |severity, timestamp, context, message| | |
case severity | |
when 'INFO' | |
severity = severity.green | |
when 'ERROR' | |
severity = severity.red | |
else 'WARN' | |
severity = severity.yellow | |
end |
View mysqldump
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
// backup | |
mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql | |
// restore | |
mysql -u root -p[root_password] [database_name] < dumpfilename.sql |
View request.js
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
var data; | |
data = { | |
user: { | |
email_address: "joe@bloggs.com", | |
provider: "linkedin", | |
uid: "1234567", | |
info: { | |
nickname: "jbloggs", | |
name: "Joe Bloggs", |
View postgres_drop_connections
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
SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'TARGET_DB' AND pid <> pg_backend_pid(); |
View interesting_behaviour.rb
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
class InterestingBehaviour | |
def perform | |
if var1.blank? | |
var1 = 56 | |
end | |
pp var1 # prints nil | |
end |
View globalpath_pretty.sh
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 globalpath(){ | |
old=$IFS | |
IFS=: | |
printf "%s\n" $PATH | |
IFS=$old | |
} |
View ram-monitor
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/sh | |
# Using /bin/sh which is guaranteed to be present on any posix system. | |
# If you want to add shell specific parts in the script than replace this. | |
# E.g. if you want to use bash specific stuff then change it to: | |
# #!/usr/bin/env bash | |
# Make sure that the shebang is on the first line of the script (no comments above it!) | |
# While true, pause 5 seconds, then append information to Mylogfile | |
# | |
# Usage: ./ram-monitor.sh >> logfile & |
View remove-trailing-spaces.sh
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
find . -name "*.haml" | xargs sed -i 's/[ \t]*$//' |
View version-checker.sh
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
# Check Ubuntu version | |
lsb_release -a | |
# Check version of the kernel | |
uname -r | |
# MongoDB version | |
mongod --version | |
# PostgreSQL version |
View webpack.rake
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
namespace :webpack do | |
desc 'create symlinks for images and fonts' | |
task symlink: :environment do | |
images_target = Rails.root.join('app', 'assets', 'images/') | |
fonts_target = Rails.root.join('app', 'assets', 'fonts/') | |
images_link = Rails.root.join('client', 'assets', 'images/') | |
fonts_link = Rails.root.join('client', 'assets', 'fonts/') | |
FileUtils.mkdir_p(images_link) | |
FileUtils.mkdir_p(fonts_link) |
OlderNewer