Skip to content

Instantly share code, notes, and snippets.

View martintsch's full-sized avatar

Martin Rechenberger martintsch

View GitHub Profile
@martintsch
martintsch / rails http status codes
Created February 2, 2019 11:20 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@martintsch
martintsch / sign-pdf.rb
Created June 5, 2018 10:35 — forked from matiaskorhonen/sign-pdf.rb
Quick and dirty PDF signing in Ruby (using Origami)
#!/usr/bin/env ruby
require "openssl"
require "time"
begin
require "origami"
rescue LoadError
abort "origami not installed: gem install origami"
end
@martintsch
martintsch / gist:82d86795f717b1f729a6eab1d3b1c6f8
Created January 25, 2018 10:20
How to delete all Docker Containers on Mac
rm Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@martintsch
martintsch / Dockerfile
Created November 15, 2017 07:29 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@martintsch
martintsch / gist:fe44c9e73014af17c62def5f42d4b958
Created October 25, 2017 14:53 — forked from chrissimpkins/gist:5bf5686bae86b8129bee
Atom Editor Cheat Sheet (Sweetmeat)

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on Mac OSX.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@martintsch
martintsch / connect-heroku-app-to-postgres-rds-with-ssl.md
Created October 25, 2017 09:59 — forked from glarrain/connect-heroku-app-to-postgres-rds-with-ssl.md
How to connect a Heroku application to an Amazon RDS PostgreSQL instance, forcing SSL and certificate chain verification

1 - Download the RDS certificates (root plus region-specific intermediate ones) bundle:

wget -O config/rds-combined-ca-bundle.pem https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem

2 - Add config/rds-combined-ca-bundle.pem to the repository and redeploy to Heroku.

3 - Update the DATABASE_URL env var:

@martintsch
martintsch / RunAProxyOnAmazonEC2VPC.md
Created July 4, 2017 13:56 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
@martintsch
martintsch / rspec_model_testing_template.rb
Created January 20, 2016 13:29 — forked from PWSdelta/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@martintsch
martintsch / gist:d928ccdfe10e65972693
Created November 11, 2015 10:39
locations by vehicle id
SELECT * FROM locations l INNER JOIN (SELECT u.first_name, u.last_name, u.id as user_id, t1.id as vehicle_id, t1.regno FROM users u INNER JOIN (SELECT * FROM vehicles v WHERE sak_activated_at IS NOT NULL AND sak_deactivated_at IS NULL) t1 ON t1.user_id = u.id) t2 ON l.vehicle_id = t2.vehicle_id;