Skip to content

Instantly share code, notes, and snippets.


Qiushi Pan qqhann

View GitHub Profile
qqhann / index.js
Created Jul 9, 2020 — forked from uiur/index.js
slack emoji -> github issue
View index.js
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) {
qqhann /
Created Jan 30, 2019 — forked from denji/
NGINX tuning for best performance

Moved to git repository:

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.

qqhann /
Created Sep 11, 2018 — forked from daniestrella1/
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
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 / 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
You can’t perform that action at this time.