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 | |
e.phone_number, | |
e.name, | |
e.public_id as employee_public_id, | |
c.name as company_name, | |
c.public_id as company_public_id, | |
d.name as division_name, | |
d.public_id as division_public_id | |
from customers_employee e | |
left join customers_company c on e.company_id = c.id |
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
# frozen_string_literal: true | |
# Stripe will retry failed webhooks seven times with exponential backoff. If that has been exceeded | |
# then the webhook event is marked "failed" and won't be retried. We can resend the event by [retrieving | |
# the event data and posting it to the | |
# webhook](https://groups.google.com/a/lists.stripe.com/forum/#!topic/api-discuss/N33ZXqp3NzI). | |
# | |
# To use this, configure your endpoint URL below, then run this in providing event IDs on the command line. | |
WEB_HOOK = "YOUR ENDPOINT HERE" |
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}' |
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
# 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
# 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
#!/usr/bin/env bash | |
# TODO: Fill in these details for the cluster and project: | |
# The GKE cluster | |
CLUSTER= | |
# Assume the app is named the same as the working directory | |
APP=$(basename $(pwd)) | |
# The GKE tag that identifies the cluster nodes | |
CLUSTER_TARGET_TAG= | |
# Expects to have `tls.crt` and `tls.key` in this 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
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
#!/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
# 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 |
NewerOlder