Skip to content

Instantly share code, notes, and snippets.

View PegasusWang's full-sized avatar
😳
失去才会懂得珍惜

PegasusWang PegasusWang

😳
失去才会懂得珍惜
View GitHub Profile
@NamPNQ
NamPNQ / .gitconfig
Created February 17, 2016 06:33 — forked from ViktorStiskala/.gitconfig
Pycharm as a default git difftool and git mergetool. Add the following to ~/.gitconfig
[diff]
tool = pycharm
[difftool "pycharm"]
cmd = /usr/local/bin/charm diff "$LOCAL" "$REMOTE" && echo "Press enter to continue..." && read
[merge]
tool = pycharm
keepBackup = false
[mergetool "pycharm"]
cmd = /usr/local/bin/charm merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"
@cloverstd
cloverstd / app.py
Last active November 4, 2019 21:33
微信二维码扫描登录
#!/usr/bin/env python
# encoding: utf-8
import tornado.ioloop
import tornado.httpclient
import tornado.web
import tornado.gen
import json
import tornado.websocket
import Queue
@tebeka
tebeka / gist:5426211
Created April 20, 2013 14:43
Serving dynamic images with Pandas and matplotlib (using flask)
#!/usr/bin/env python2
'''Serving dynamic images with Pandas and matplotlib (using flask).'''
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from cStringIO import StringIO
@brantfaircloth
brantfaircloth / sphinx_to_github.sh
Created January 23, 2011 02:40
Sphinx documentation to github gh-pages without submodules
# assume the following directory structure where contents of doc/
# and source/ are already checked into repo., with the exception
# of the _build directory (i,e. you can check in _themes or _sources
# or whatever else).
#
# proj/
# source/
# doc/
# remove doc/_build/html if present
@justincase
justincase / gist:5469009
Created April 26, 2013 17:45
Print struct with field names and values. From http://blog.golang.org/2011/09/laws-of-reflection.html
type T struct {
A int
B string
}
t := T{23, "skidoo"}
s := reflect.ValueOf(&t).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
@nucliweb
nucliweb / fortune-cowsay-lolcat.md
Last active April 3, 2022 01:22
fortune | cowsay | lolcat

fortune | cowsay | lolcat

Install Brew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install fortune

brew search fortune
@iksky
iksky / Mac下开机自动连接ssh -D.txt
Created November 16, 2011 02:11
Mac下开机自动连接ssh -D
首先我们来生成公钥文件。Terminal下面输入
ssh-keygen -t rsa
之后在Terminal的提示里按回车。直到生成id_rsa.pub文件,生成的id_rsa.pub文件在 ~/.ssh下面。Terminal下面输入
cd ~/.ssh
cp id_rsa.pub authorized_keys
上面第一句的意思是进入~/.ssh文件夹,第二句是复制id_rsa.pub为authorized_keys文件。
@justinfx
justinfx / enc_dec_test.py
Last active October 16, 2022 13:28
Speed test of common serializers on python 2.7.2 (pickle, cPickle, ujson, cjson, simplejson, json, yajl, msgpack)
"""
Dependencies:
pip install tabulate simplejson ujson yajl msgpack
"""
from timeit import timeit
from tabulate import tabulate
setup = '''d = {
'words': """
@XuankangLin
XuankangLin / clipboard.py
Created January 28, 2017 04:20
Read from and Write to clipboards in python scripts, works on Mac at least.
import subprocess
def getClipboardData():
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE)
retcode = p.wait()
data = p.stdout.read()
return data
def setClipboardData(data):
p = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE)