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
# A one-line script to change the origin organization name. | |
# | |
# After renaming our organization at GitHub, I had 25 repos I needed to update locally. | |
# This script finds the current "origin", removes it and replaces it with a new one | |
# with the organization changed. | |
# | |
# Just change OLD_ORG and NEW_ORG below to the old and new organization names and run | |
# this in each repository. | |
f=`git remote -v | grep '^origin' | cut -c 8- | cut -d' ' -f 1 | uniq`; git remote remove origin; git remote add origin ${f/OLD_ORG/NEW_ORG} |
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
[unknown]LOG: connection received: host=::1 port=58397 | |
my-app-test LOG: connection authorized: user=jeremywadsack database=my-app-test | |
my-app-test LOG: statement: set client_encoding to 'UTF8' | |
my-app-test LOG: statement: set client_encoding to 'utf8' | |
my-app-test LOG: statement: SET client_min_messages TO 'WARNING' | |
my-app-test LOG: statement: SHOW client_min_messages | |
my-app-test LOG: statement: SET client_min_messages TO 'panic' | |
my-app-test LOG: statement: SET standard_conforming_strings = on | |
my-app-test LOG: statement: SET client_min_messages TO 'warning' | |
my-app-test LOG: statement: SET time zone 'UTC' |
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
# A jQuery plugin to convert UTC times to local times on the browser. | |
# | |
# You can apply this to any element on the page like this: | |
# | |
# $('#message').covertToLocalDate(); | |
# | |
# This looks for one or more date-time strings in the original element | |
# and replaces them. The existing dates must be in the format | |
# 2015-07-14 16:30:00 UTC | |
# It replaces them with an <abbr> element (which is usually styled with |
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
# lib/capistrano/tasks/assets.rake | |
namespace :deploy do | |
desc "Precompile assets locally and then rsync to web servers" | |
task :compile_assets => [:set_rails_env] do | |
run_locally do | |
with rails_env: :production do | |
execute "bundle exec rake assets:precompile" | |
end | |
end |
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 bash | |
# Uses du to track the amount of disk space that postgres is using to hold queries that don't fit in memory. | |
# Uses smem to track USS, PSS, and RSS for the postrgres user for various views of how much memory it is using. | |
# Add this to crontab to run every minute. | |
# * * * * * /path/to/pg_graphite.sh | |
# Configure for your graphite host | |
PORT=2003 | |
SERVER=carbon.hostedgraphite.com | |
API_KEY=11111111-2222-3333-4444-5555555555 |
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
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: all-memory-deployment | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: bash |
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
# Kuberentes doesn't provide information about resource resquest in the `get` command, even in JSON mode | |
# This is the best I've got for getting a report of the total resource request allocation per node | |
kubectl describe nodes | egrep -A 4 '^Name:|^Allocated resources' | egrep '^Name:|Requests|%)' |
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
# Safely cleans up your rvm Gemsets with the following: | |
# - Deletes gemsets associated with older rubies than the latest (if more than one) | |
# - Runs `bundle clean` to remove unused gems in latest gemsets | |
# - Removes rubies (and related gemsets) that are no longer used by a gemset | |
gemsets = Dir["#{ENV['HOME']}/.rvm/gems/*"].select do |folder| | |
folder.include?("@") | |
end | |
gemsets = gemsets.map do |folder| | |
File.basename(folder) |
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 Schema | |
def load source | |
... | |
add_fields_to_schema(schema, source_fields) | |
self | |
end | |
def add_fields_to_schema schema, fields |
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 bash | |
# Records a line with the following space-separated fields | |
# date-time k-pg-tmp-work-mem k-pg-uss k-pg-pss k-pg-rss | |
cat <(du -sk /data/pgsql/9.5/data/base/pgsql_tmp/) <(/usr/local/bin/smem -u | grep postgres) | paste -s | awk '{print strftime("%FT%TZ") " " $1 " " $6 " " $7 " " $8}' |
OlderNewer