Skip to content

Instantly share code, notes, and snippets.

View johnrlive's full-sized avatar

John Rodriguez johnrlive

  • NY
View GitHub Profile
# Rails production setup via SQLite3 made durable by https://litestream.io/
# Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine.
#
# try locally: docker build . -t rails && docker run -p3000:3000 -it rails
#
# in production you might want to map /data to somewhere on the host,
# but you don't have to!
#
FROM ruby:3.0.2
FROM phusion/passenger-full:1.0.12
# Set correct environment variables.
ENV HOME /root
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
# ...put your own build instructions here...
@johnrlive
johnrlive / .env.php
Created November 21, 2019 14:31
WordPress environment variables
<?php
define('DB_HOST', 'localhost');
define('DB_NAME', 'name');
define('DB_USER', 'user');
define('DB_PASSWORD', 'password');
/**
* You can also include other environment specifc
* definitions here, such as enabling debug for
@johnrlive
johnrlive / cloudflare-ddns-update.sh
Created September 5, 2019 04:59 — forked from Tras2/cloudflare-ddns-update.sh
A bash script to update a Cloudflare DNS A record with the external IP of the source machine
#!/bin/bash
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine
# Used to provide DDNS service for my home
# Needs the DNS record pre-creating on Cloudflare
# Proxy - uncomment and provide details if using a proxy
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport>
# Cloudflare zone is the zone which holds the record
@johnrlive
johnrlive / 1. linux utilities.md
Created March 21, 2019 14:57 — forked from Integralist/1. linux utilities.md
Different Linux utility commands (e.g. top, ps, strace, lsof, netstat, ifconfig, iftop, iptraf, tcpdump, wireshark)

Start up a container (whichever Linux flavour takes your fancy):

docker run -it ubuntu /bin/bash
docker run -it centos /bin/bash
  • top: check what CPU and Memory running processes are utilising
  • ps: see what processes are running
  • strace: monitor interactions between processes
@johnrlive
johnrlive / up-and-running-with-edeliver-on-do.md
Created March 11, 2019 23:58 — forked from davoclavo/up-and-running-with-edeliver-on-do.md
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new ubuntu droplet

Setup Server

# This is a blocklist to block samsung smart tv's sending meta data at home.
# Please help to collect domains!
# It could be that the TV does not receive any more updates or other services no longer work. Please report such an incident.
device-metrics-us.amazon.com
samsungacr.com
samsungcloudsolution.com
samsungcloudsolution.net
pavv.co.kr
samsungotn.net
function prompt_wikimatze_precmd {
git-info
}
function prompt_wikimatze_setup {
setopt LOCAL_OPTIONS
unsetopt XTRACE KSH_ARRAYS
prompt_opts=(cr percent subst)
# Load required functions.
@johnrlive
johnrlive / gist:2863412db66222d0ad4055ccd864ca78
Last active February 2, 2019 05:04 — forked from samnang/gist:1759336
Install Bash version 4 on MacOS X
# Install Bash 5 using homebrew
# brew install bash
# Or build bash 4 from source...
curl -O http://ftp.gnu.org/gnu/bash/bash-4.4.18.tar.gz
tar xzf bash-4.4.18.tar.gz
cd bash-4.4.18
./configure --prefix=/usr/local/bin && make && sudo make install
# Add the new shell to the list of legit shells
@johnrlive
johnrlive / postgres-cheatsheet.md
Last active November 20, 2018 18:39 — forked from Kartones/postgres-cheatsheet.md
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)