Skip to content

Instantly share code, notes, and snippets.

View phoet's full-sized avatar
:shipit:
Shippin Stuffs 🚀

Peter Schröder phoet

:shipit:
Shippin Stuffs 🚀
View GitHub Profile
@phoet
phoet / vrtucar.md
Last active August 29, 2015 13:56
VRTUCAR requirements

A lot of people @Shopify would love to use VRTUCAR. Some of them already do so.

The Business-Plan does not cut it, because Shopify does not want to pay for all the trips of the Employees. They want something that can be used as a perk with a fixed price.

For example: pay a monthly fee and provide reduced rates on driving per employee

If you can help with that please contact brittany AT shopify.com.

@phoet
phoet / bacon_infused.rb
Last active August 29, 2015 13:56
bacon infused middleware
# application.rb
#
# config.middleware.use "BaconInfused"
class BaconInfused
def initialize(app)
@app = app
end
def call(env)
A chat representative will be with you in about 0 minute(s). Thank you for waiting.
Dietrich has joined the session and is ready to help. To start, please provide your name and home phone number.
Dietrich: Hello! Welcome to Bell Internet Services. How may I help you today?
You: hi dietrich
You: i want to cancel my contract by july 31th
Dietrich: I understand that you want to cancel the contract.
Dietrich: Please do not worry, I will check all the details
You: thx
Dietrich: Sure, I will help you.
Dietrich: Do you want to cancel the service?
@phoet
phoet / restart_all_apps.rb
Last active August 29, 2015 14:05
heroku plugin search
#! /usr/bin/env ruby
require_relative 'util'
include Util
auth_key = key_hash(ARGV.last)
puts "restarting all processes"
apps = curl('https://api.heroku.com/apps', auth_key)
apps.each do |app|
de:
typus:
shared:
no_entries_found: "Keine Einträge gefunden."
help: "Hilfe"
settings: "Einstellungen"
confirm_question: "Bist du sicher?"
restore_question: 'Wiederherstellen?'
buttons:
@phoet
phoet / reroute_dns.md
Last active August 29, 2015 14:07
Chromecast DNS to unblock-us via an iMac

I use unblock-us to access services that have this really stupid idea of IP-based positioning (hey guys, my IP does not mean anything!). This service (like many others) proxies your DNS traffic through their own servers so you can pretend to be anywhere on the planet. You only have to add their DNS-servers to your computers network settings or to your WIFI-router so all your devices can use it without changing their configuration.

Unfortunately, the chromecast has it's own google DNS configured and those google assholes don't let you change it or disable the feature. In the linked support thread, you can see how you can spoof the DNS traffic using iptables in your router, so the chromecast will actually talk to unblock-us instead.

My WIFI router is an oldish Apple Timecapsule and those things are quite 💩 when it comes to co

@phoet
phoet / Gemfile
Last active August 29, 2015 14:10
double default_scope query
# A sample Gemfile
source "https://rubygems.org"
gem 'activerecord', github: 'rails/rails', branch: 'master'
gem 'arel', github: 'rails/arel', branch: 'master'
gem 'pg'
@phoet
phoet / docker_alias.sh
Created January 16, 2015 13:43
docker-shell-alias-function
function docker {
cmd=/usr/local/bin/docker
case $1 in
"status") shift && $cmd ps $@;;
*) $cmd $@;;
esac
}
@phoet
phoet / vagrant_nfs_inversion.rb
Created February 19, 2015 21:00
Running Vagrant with inverted NFS directories
config.export_nfs.each do |export|
config.trigger.before :halt, stdout: true do
mount_point = export[1]
system("sudo umount -f #{mount_point}")
end
config.trigger.after [:up, :reload], stdout: true do
remote_point = "#{PRIVATE_IP}:#{export[0]}"
mount_point = export[1]
puts "mounting #{remote_point} to #{mount_point}"
@phoet
phoet / heroku.rake
Created February 26, 2015 14:28
heroku GC settings generator for rails
namespace :heroku do
desc "generate GC settings"
task gc: [:environment] do
# https://discussion.heroku.com/t/tuning-rgengc-2-1-on-heroku/359/6
# http://tmm1.net/ruby21-rgengc/
# http://thorstenball.com/blog/2014/03/12/watching-understanding-ruby-2.1-garbage-collector/
# http://collectiveidea.com/blog/archives/2015/02/19/optimizing-rails-for-memory-usage-part-1-before-you-optimize/
settings = {
RUBY_GC_HEAP_FREE_SLOTS: 600000, # default is 4096,
RUBY_GC_HEAP_GROWTH_FACTOR: 1.25, # default is 1.8,