Skip to content

Instantly share code, notes, and snippets.


Qiushi Pan qqhann

View GitHub Profile
qqhann / config.cson
Last active Mar 14, 2017
Atomおすすめプラグイン〜導入まで ref:
View config.cson
python: "python3"
View file2.txt
$ brew install nginx
$ cd /usr/local/etc/nginx
$ cp nginx.conf.default nginx.conf
$ cp nginx.conf nginx.conf.YYYYMMDD
$ vi nginx.conf
qqhann / 0_reuse_code.js
Last active May 29, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View nginx.conf
upstream unicorn {
# nginxとunicornの連携
# unicorn.rbで設定したunicorn.sockを指定
server unix:{RAILS_PROJECT_ROOT}/tmp/sockets/unicorn.sock; #ソケットはこいつだ!socketsを追加
server {
listen 8081;
qqhann /
Last active Jul 18, 2017
[Python] フィボナッチ数列をジェネレータで生成 ref:
def fibonacci(n):
a, b = 0, 1
for _ in range(n):
yield a
a, b = b, b+a
View String replace, regex
# string
string = 'A string with what to be replaced.'
result = string.replace('what to be replaced', 'what to replace')
# regex
import re
result = re.sub(r'what to be replaced', 'what to replace', string)
qqhann /
Created Aug 12, 2017 — forked from endolith/
GCD and LCM functions in Python
# Greatest common divisor of more than 2 numbers. Am I terrible for doing it this way?
def gcd(*numbers):
"""Return the greatest common divisor of the given integers"""
from fractions import gcd
return reduce(gcd, numbers)
# Least common multiple is not in standard libraries? It's in gmpy, but this is simple enough:
def lcm(*numbers):
qqhann /
Created Aug 13, 2017
UTF-8 へ一括変換&「¥」を「\」へ書き換えるshスクリプト ref:
# $dir以下の全てのファイルに対して行う。
for file in `find $dir -type f`;
echo $file
# encoding_converter.sh自身だった場合にスキップする。
if expr $file : ".*$0" > /dev/null; then
echo "$0 itself. skip!"
qqhann / styles.less
Last active Aug 13, 2017
Atom 行番号の背景をカスタマイズ ref:
View styles.less
atom-text-editor .gutter {
color: #cccccc;
background-color: #353739;
qqhann /
Last active Aug 14, 2017
Atomのウィンドウサイズ、プロジェクトツリーのサイズを固定する ref:
atom.setSize(900, 800)
You can’t perform that action at this time.