Skip to content

Instantly share code, notes, and snippets.

View scott's full-sized avatar

Scott Miller scott

View GitHub Profile
@gaganremba
gaganremba / passenger_process_monitor.rb
Created July 25, 2017 13:38
Script for killing errant passenger processes
#!/usr/bin/env ruby
#
# Passenger management script
# By James Smith http://loopj.com
# Based heavily on a similar script by Jon Bettcher
#
# Check memory usage of all paseenger child process and kill if grows
# too large.
#
@oinopion
oinopion / read-access.sql
Created October 5, 2016 13:00
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@padde
padde / lets-encrypt-nginx.md
Last active July 10, 2018 15:07
Let's Encrypt with Nginx

Let's Encrypt with Nginx

Here's how I set up a tiny Nginx/Rails server that uses HTTPS via a Let's Encrypt issued certificate.

https://letsencrypt.paddd.de/

Server

I use the smallest DigitalOcean droplet (512 MB) here, which is built from the "Ubuntu Ruby on Rails on 14.04" image provided by them.

@gokulkrishh
gokulkrishh / media-query.css
Last active April 18, 2024 18:20
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@ssaunier
ssaunier / sidekiq.config
Created September 24, 2015 09:30
Running Sidekiq on AWS Elastic Beanstalk (Put that file in `.ebextensions` folder)
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@maxivak
maxivak / readme.md
Last active January 12, 2024 06:53
Integrating Gem/Engine and Main Rails App
@ChuckJHardy
ChuckJHardy / digital_ocean_setup.md
Last active October 27, 2023 17:51
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

@Kartones
Kartones / postgres-cheatsheet.md
Last active April 19, 2024 13:15
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@wrburgess
wrburgess / gist:5528649
Last active November 24, 2022 15:29
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production