Skip to content

Instantly share code, notes, and snippets.

View chareice's full-sized avatar

ChengLei Shao chareice

  • GuangZhou China
View GitHub Profile
@chareice
chareice / psql-with-gzip-cheatsheet.sh
Created April 13, 2020 03:36 — forked from brock/psql-with-gzip-cheatsheet.sh
Exporting and Importing Postgres Databases using gzip
# This is just a cheat sheet:
# On production
sudo -u postgres pg_dump database | gzip -9 > database.sql.gz
# On local
scp -C production:~/database.sql.gz
dropdb database && createdb database
gunzip < database.sql.gz | psql database
@chareice
chareice / golang, ubuntu go get in china.md
Created November 15, 2018 00:16 — forked from alexniver/golang, ubuntu go get in china.md
ubuntu下, 使用shadowsock和Privoxy帮助你在命令行中, 无障碍进行go get

#前言 由于大家都懂的, 国内使用go get的时候, 经常会各种失败, 如果有vpn的话, 打开vpn, 问题就解决了, 但vpn其实挺不灵活的.

相对来说shadowsock则灵活得多.

#解决方案 shadowsock + Privoxy

思路就是, 使用shadowsock建立一个本地sock5代理, 但因为go get 需要http代理, 所以需要使用privoxy把sock5代理转为http代理.

@chareice
chareice / clean.sh
Created September 22, 2018 06:08
clean up docker daily
echo "$(echo '0 3 * * * /usr/bin/docker system prune -f' ; crontab -l)" | crontab -
@chareice
chareice / mix.exs
Created September 29, 2016 15:15
Mix created mix.exs file
defmodule KV.Mixfile do
use Mix.Project
def project do
[app: :kv,
version: "0.1.0",
elixir: "~> 1.3",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps()]
@chareice
chareice / install_ffmpeg_ubuntu.sh
Created March 24, 2016 03:00 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
@chareice
chareice / rm_mysql.md
Created March 11, 2016 13:54 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
set :domain, 'esdb.cn'
set :identity_file, '/User/somebody/.ssh/somebody.pem'
set :deploy_to, '/home/ubuntu/apps/xxx.com'
set :repository, 'ssh://git@bitbucket.org/somebody/xxx.com.git'
set :branch, 'master'
@chareice
chareice / validation.php
Created February 1, 2015 08:47
Localization Validation Message For Chineses With Laravel 5
<?php
use Symfony\Component\Yaml\Yaml;
return Yaml::parse(file_get_contents(base_path().'/resources/lang/zh_cn/validation.yml'));
@chareice
chareice / .vimrc
Created December 17, 2014 13:31
vimrc
execute pathogen#infect()
filetype plugin indent on
syntax on
set nu
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
@chareice
chareice / gfwlist.js
Created December 17, 2014 13:31
gfwlist.js
// Generated by gfwlist2pac
// https://github.com/clowwindy/gfwlist2pac
var domains = {
"vimcasts.org" : 1,
"vim.org" : 1,
"wenincode.com" : 1,
"amazonaws.com" : 1,
"codeception.com" : 1,
"opensuse.org" : 1,