Skip to content

Instantly share code, notes, and snippets.

View FingerLiu's full-sized avatar
😀
coding

FingerLiu FingerLiu

😀
coding
View GitHub Profile
@FingerLiu
FingerLiu / squash-commits.md
Created July 17, 2019 03:18 — forked from longtimeago/squash-commits.md
How to squash commits in a GitHub pull request

How to squash commits in a GitHub pull request

o you've contributed some code to an open source project, say, Rails. And they'd like you to squash all of the commits in your pull request. But you're not a git wizard; how do you make this happen?

Normally, you'd do something like this. I'm assuming upstream is a git remote that is pointing at the official project repository, and that your changes are in your 'omgpull' branch:

@FingerLiu
FingerLiu / inspect.go
Created January 26, 2019 14:54
inspect json and generate graphql schema
package main
/*
parse json, extract type in json and save to graphql.schema
*/
import (
"io/ioutil"
"encoding/json"
"reflect"
"fmt"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def pretty_print_tree(tree, indent=0):
"""print pretty tree str"""
print(' '*indent + 'Tree(%s)' % (tree.key))
if tree.children:
print(' '*indent + 'children:')
for child in tree.children:
@FingerLiu
FingerLiu / run-docker-ss.sh
Created June 30, 2017 02:29
run ss in one line
docker run -dt --name ss -p 7890:7890 mritd/shadowsocks -s "-s 0.0.0.0 -p 7890 -m aes-256-cfb -k mypassword --fast-open"
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>大学生超市(5号店)</title>
@FingerLiu
FingerLiu / surf.md
Created June 4, 2017 04:26
在终端科学上网

1. 找到一台 shadowsocks 服务器的配置

2. 在本地 sslocal 连到 shadowsocks 服务器

3. proxychain 或 proxychain-ng 连到 sslocal

4. proxychain curl google.com

@FingerLiu
FingerLiu / sqldump.sh
Created June 4, 2017 04:25
tcmpdump sql query
#!/bin/bash
#this script used monitor mysql network traffic.echo sql
tcpdump -i eth1 -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i)
{
if (defined $q) { print "$q\n"; }
$q=$_;
} else {
$_ =~ s/^[ \t]+//; $q.=" $_";
@FingerLiu
FingerLiu / xml.snippets
Created June 4, 2017 04:24
odoo_snippet
snippet xml
<?xml version="1.0" encoding="UTF-8"?>
# tag
snippet t
<${1:}${2}>
</$1>
# inline tag
snippet ti
@FingerLiu
FingerLiu / setup_odoo.sh
Created June 4, 2017 04:23
odoo 踩坑
doo
add code.cloudist.cc to hosts to speedup download.
set deploy key.
clone seed-ERP
export USER=root
python setup_dev setup_deps
sudo -i -u postgres
@FingerLiu
FingerLiu / supervim.vimrc
Created June 4, 2017 04:21
超级 vimrc
scriptencoding utf-8
" ============================================================================
" Author: TaoBeier
" Blog: http://moelove.info
" Version: v1.1.0
" Update Time: 2016-09-25
" ============================================================================
" Vundle initialization
" Avoid modify this section, unless you are very sure of what you are doing