Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
StayHome

Qiushi Pan qqhann

🏠
StayHome
View GitHub Profile
@qqhann
qqhann / config.cson
Last active Mar 14, 2017
Atomおすすめプラグイン〜導入まで ref: http://qiita.com/Qiuqiu/items/63ec28715547c0f68b1b
View config.cson
"*":
"runner":
scopes:
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
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;
server_name {PROJECTDOMAIN_FOR_LOCAL};
@qqhann
qqhann / fibonacci.py
Last active Jul 18, 2017
[Python] フィボナッチ数列をジェネレータで生成 ref: http://qiita.com/Qiuqiu/items/d0eddd1a804d3c66d5f3
View fibonacci.py
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
qqhann / gcd_and_lcm.py
Created Aug 12, 2017 — forked from endolith/gcd_and_lcm.py
GCD and LCM functions in Python
View gcd_and_lcm.py
# 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
qqhann / encoding_converter.sh
Created Aug 13, 2017
UTF-8 へ一括変換&「¥」を「\」へ書き換えるshスクリプト ref: http://qiita.com/Qiuqiu/items/45586c2ca10f1c9e3137
View encoding_converter.sh
#!/bin/sh
dir="`pwd`"
# $dir以下の全てのファイルに対して行う。
for file in `find $dir -type f`;
do
echo $file
# encoding_converter.sh自身だった場合にスキップする。
if expr $file : ".*$0" > /dev/null; then
echo "$0 itself. skip!"
continue
@qqhann
qqhann / styles.less
Last active Aug 13, 2017
Atom 行番号の背景をカスタマイズ ref: http://qiita.com/Qiuqiu/items/4d9d22422128a5d288b1
View styles.less
atom-text-editor .gutter {
color: #cccccc;
background-color: #353739;
}
@qqhann
qqhann / init.coffee
Last active Aug 14, 2017
Atomのウィンドウサイズ、プロジェクトツリーのサイズを固定する ref: http://qiita.com/Qiuqiu/items/994c52202bb84f8e6835
View init.coffee
atom.setSize(900, 800)
You can’t perform that action at this time.