Skip to content

Instantly share code, notes, and snippets.

View qqpann's full-sized avatar
🍊

Qiushi Pan qqpann

🍊
View GitHub Profile
[
{
"word": "Asshole",
"kana": "アスホール",
"meaning": "いやな奴(Ass=お尻、Hole=穴)",
"notice": "「うざい野郎」「ろくでなし」"
},
{
"word": "あばずれ",
"kana": "あばずれ",
@qqpann
qqpann / index.js
Created July 9, 2020 02:33 — forked from uiur/index.js
slack emoji -> github issue
const axios = require('axios')
const decode = require('decode-html')
const CHANNEL = '#dev'
const ISSUE_REPO = 'foo/bar'
exports.otochan = (req, res) => {
console.log('Received request:', req.body)
// slack challenge
if (req.body.challenge) {
@qqpann
qqpann / nginx-tuning.md
Created January 30, 2019 16:42 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@qqpann
qqpann / middleware.py
Created September 11, 2018 07:22 — forked from daniestrella1/middleware.py
Django middleware to log the total number of queries run and query time for every request
from django.db import connection
import logging
logger = logging.getLogger(__name__)
class QueryCountDebugMiddleware(object):
"""
This middleware will log the number of queries run
and the total time taken for each request (with a
status code of 200). It does not currently support
@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 / 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