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 / 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 / install_chef.sh
Last active August 29, 2015 14:21 — forked from bladelee/setup ruby2.0 and chef-solo
setup ruby2.0 and chef-solo
sudo apt-get -y update
sudo apt-get --no-install-recommends -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev vim
# Download and compile Ruby 2.0.0-p0
cd /tmp
#wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
wget http://ruby.taobao.org/mirrors/ruby/2.0/ruby-2.0.0-p353.tar.gz
tar -xvzf ruby-2.0.0-*.tar.gz
cd ruby-2.0.0-*
./configure --prefix=/usr/local
@SammyLin
SammyLin / gist:5c17bdabc42e1f079cae
Created January 8, 2015 02:24 — forked from kogakure/gist:79851
刪除 Frontpage, WSFTP 等等產生的檔案 Bash: Get rid of those nasty files from Frontpage, WSFTP, etc.
#!/bin/bash
find . -name _vti_cnf -exec rm -rf {} \;
find . -name _borders -exec rm -rf {} \;
find . -name _private -exec rm -rf {} \;
find . -name _vti_pvt -exec rm -rf {} \;
find . -name _vti_txt -exec rm -rf {} \;
find . -name _vti_script -exec rm -rf {} \;
find . -name .DS_Store -exec rm -rf {} \;
find . -name WS_FTP.LOG -exec rm -rf {} \;
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory