Skip to content

Instantly share code, notes, and snippets.

Matt Slater delameko

View GitHub Profile
@delameko
delameko / postgres.sh
Last active Sep 21, 2018
Postgres cheatsheet
View postgres.sh
# List users (with permissions)
\du
# List databases
\l
# List schemas, with privileges
\dn+
# List table privileges
@delameko
delameko / cheatsheet.sh
Last active Sep 20, 2018
Shell command cheatsheet
View cheatsheet.sh
#############
# Processes #
#############
# Finding a running process
ps aux | grep <processname>
pgrep <processname>
# Killing processes
#
@delameko
delameko / iso-3166-1_codes.ex
Created May 12, 2017
ISO 3166-1 (alpha 2) country codes, in an Elixir list
View iso-3166-1_codes.ex
country_codes = [
%{ iso_3166_1: "AF", name: "Afghanistan" },
%{ iso_3166_1: "AX", name: "Aland Islands" },
%{ iso_3166_1: "AL", name: "Albania" },
%{ iso_3166_1: "DZ", name: "Algeria" },
%{ iso_3166_1: "AS", name: "American Samoa" },
%{ iso_3166_1: "AD", name: "Andorra" },
%{ iso_3166_1: "AO", name: "Angola" },
%{ iso_3166_1: "AI", name: "Anguilla" },
%{ iso_3166_1: "AQ", name: "Antarctica" },
@delameko
delameko / iso-639-1_codes.ex
Created May 11, 2017
ISO 639-1 language codes in Elixir
View iso-639-1_codes.ex
iso_codes = [
%{ iso_639_1: "ab", name: "Abkhazian" },
%{ iso_639_1: "aa", name: "Afar" },
%{ iso_639_1: "af", name: "Afrikaans" },
%{ iso_639_1: "ak", name: "Akan" },
%{ iso_639_1: "sq", name: "Albanian" },
%{ iso_639_1: "am", name: "Amharic" },
%{ iso_639_1: "ar", name: "Arabic" },
%{ iso_639_1: "an", name: "Aragonese" },
%{ iso_639_1: "hy", name: "Armenian" },
@delameko
delameko / upgrade-postgres-9.5-to-9.6.md
Last active May 4, 2020 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04
View upgrade-postgres-9.5-to-9.6.md

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
@delameko
delameko / gist:184e4d3a4971a17314443afa0a4df0bd
Created Jul 13, 2016 — forked from koudelka/gist:f4d07b9d998d723e55a0
Possible http status codes module for Elixir Phoenix Web Framework
View gist:184e4d3a4971a17314443afa0a4df0bd
#
# Would this be useful to Phoenix?
#
# In controllers, it'd be nice to be able to refer to status codes as atoms instead of integers.
#
defmodule Phoenix.Controller.StatusCodes do
@http_status_codes %{
@delameko
delameko / screen-resolutions.md
Last active Jan 28, 2016
Popular screen resolutions
View screen-resolutions.md

#Most Popular Screen Resolutions

##Apple

Resolution Device
320×480 iPhone 3GS
640×960 iPhone 4S
1024×768 iPad 1/2/Mini
1024×768+ Desktops/Laptops
View kibana-4.x-default
user="kibana"
group="root"
chroot="/"
chdir="/"
nice=""
@delameko
delameko / positivessl_setup.md
Last active Dec 15, 2015
Setup a PositiveSSL certificate on Nginx
View positivessl_setup.md

Generate key:

openssl req -nodes -newkey rsa:2048 -keyout my_domain.key -out my_domain.csr

Use the CSR file to buy your certificate.

Comodo will send a my_domain.crt and a my_domain.ca-bundle file.

Combine them:

@delameko
delameko / server-setup.md
Last active Dec 16, 2015
Setting up a new Ubuntu 14.04 server
View server-setup.md

Log in as root

ssh root@123.45.67.890

Change root password

passwd

Create new user

You can’t perform that action at this time.