Skip to content

Instantly share code, notes, and snippets.

View SammyLin's full-sized avatar
:octocat:
大家好

Sammy Lin SammyLin

:octocat:
大家好
View GitHub Profile
@SammyLin
SammyLin / mysql-diagnostics.sh
Created April 7, 2018 15:52
mysql-diagnostics.sh
#!/bin/sh
######################################################
#
# SETTINGS
# PLEASE SET VARIABLES BELOW
#
# RDSUSER requires at least a PROCESS PRIVILEGE
#
# It's advised to call this script as unpriviled user from cron. Please set proper permissions for STAT_DIR to allow that user to write files in that directory
@SammyLin
SammyLin / install_ghost.sh
Last active May 11, 2017 08:27 — forked from bradfordpythian/install_ghost.sh
Install gh-ost - MySQL Online Schema Change Tool
# Latest version can be identifed at https://github.com/github/gh-ost/releases/latest
cd /tmp
[ -z "${GHOST_VERSION}" ] && GHOST_VERSION="20170403125842"
wget https://github.com/github/gh-ost/releases/download/v1.0.36/gh-ost-binary-linux-${GHOST_VERSION}.tar.gz
tar xvfz gh-ost-binary-linux-${GHOST_VERSION}.tar.gz
file gh-ost
sudo mv gh-ost /usr/local/bin
@SammyLin
SammyLin / pg-linux.md
Created December 15, 2016 09:43 — forked from erickrawczyk/pg-linux.md
Installing PostgreSQL 9.4 on Ubuntu 14.04 or 15.04

Installing Postgres on Ubuntu:

http://www.postgresql.org/download/linux/ubuntu/

  • Install postgres
    • create the file /etc/apt/sources.list.d/pgdg.list
    • add one of the following lines to the file based on ubuntu version:
      • 14.04: deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
      • 15.04: deb http://apt.postgresql.org/pub/repos/apt/ wily-pgdg main
    • import signing key:
@SammyLin
SammyLin / install_postgresql9.4_postgis2.1_ubuntu.md
Created December 15, 2016 09:43 — forked from ansell/install_postgresql9.4_postgis2.1_ubuntu.md
Installing PostgreSQL 9.4 and PostGIS on Ubuntu 14.04

Remove old PostGIS Installation

The first step is to remove older version of PostGIS if any.

sudo apt-get purge postgis

Setup repository

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
@SammyLin
SammyLin / README.md
Created July 23, 2016 01:20 — forked from githubutilities/README.md
Shadowsocks proxy and ssh proxy

Shadowsocks Proxy

apt-get install python-pip
pip install shadowsocks

sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start
@SammyLin
SammyLin / upgrade-postgres-9.3-to-9.5.md
Created April 15, 2016 08:15 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
@SammyLin
SammyLin / postgres-cheatsheet.md
Created February 24, 2016 04:51 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*

@SammyLin
SammyLin / docker_1.9_on_ubuntu_14.04.md
Created November 27, 2015 10:38 — forked from ochinchina/docker_1.9_on_ubuntu_14.04.md
install the docker 1.9-dev to ubuntu 14.04

###add patch

get the script from https://get.docker.com/ubuntu/, the script is:

# Check that HTTPS transport is available to APT
if [ ! -e /usr/lib/apt/methods/https ]; then
	apt-get update
	apt-get install -y apt-transport-https
fi
@SammyLin
SammyLin / china_dns.md
Last active August 29, 2015 14:26
中國 DNS 列表