Skip to content

Instantly share code, notes, and snippets.

View qqpann's full-sized avatar
🍊

Qiushi Pan qqpann

🍊
View GitHub Profile
@qqpann
qqpann / config.cson
Last active March 14, 2017 07:06
Atomおすすめプラグイン〜導入まで ref: http://qiita.com/Qiuqiu/items/63ec28715547c0f68b1b
"*":
"runner":
scopes:
python: "python3"
$ brew install nginx
$ cd /usr/local/etc/nginx
$ cp nginx.conf.default nginx.conf
$ cp nginx.conf nginx.conf.YYYYMMDD
$ vi nginx.conf
@qqpann
qqpann / 0_reuse_code.js
Last active May 29, 2017 12:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@qqpann
qqpann / (A).
Last active January 18, 2018 11:49
Rails5をproduction(本番環境)で起動する時に嵌ったこと ref: https://qiita.com/qiugits/items/7cd01f4b5cff4a31e053
$ export SECRET_KEY_BASE=`bundle exec rake secret`
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};
@qqpann
qqpann / fibonacci.py
Last active July 18, 2017 08:19
[Python] フィボナッチ数列をジェネレータで生成 ref: http://qiita.com/Qiuqiu/items/d0eddd1a804d3c66d5f3
def fibonacci(n):
a, b = 0, 1
for _ in range(n):
yield a
a, b = b, b+a
# 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)
@qqpann
qqpann / gcd_and_lcm.py
Created August 12, 2017 13:03 — forked from endolith/gcd_and_lcm.py
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):
@qqpann
qqpann / encoding_converter.sh
Created August 13, 2017 08:19
UTF-8 へ一括変換&「¥」を「\」へ書き換えるshスクリプト ref: http://qiita.com/Qiuqiu/items/45586c2ca10f1c9e3137
#!/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
@qqpann
qqpann / styles.less
Last active August 13, 2017 11:30
Atom 行番号の背景をカスタマイズ ref: http://qiita.com/Qiuqiu/items/4d9d22422128a5d288b1
atom-text-editor .gutter {
color: #cccccc;
background-color: #353739;
}