Skip to content

Instantly share code, notes, and snippets.

View ssskip's full-sized avatar
💭
I may be slow to respond.

ssskip

💭
I may be slow to respond.
View GitHub Profile
@ssskip
ssskip / dump.sh
Last active October 25, 2017 16:25
mysql dump on slave
mysqldump -u xxx -p -Qce -R --apply-slave-statements --single-transaction —tz-utc --flush-privileges —master-data=2 --max-allowed-packet=900M --databases xxx|pv|gzip > dump.sql.gz
@ssskip
ssskip / nginx.logrotate
Last active September 1, 2017 04:01
nginx sytemctl
/var/log/nginx/*log {
create 0644 nginx nginx
daily
rotate 10
missingok
notifempty
compress
sharedscripts
postrotate
/bin/kill -USR1 `cat /run/nginx.pid 2>/dev/null` 2>/dev/null || true
@ssskip
ssskip / build_nginx.sh
Last active October 14, 2016 09:37 — forked from Belphemur/build_nginx.sh
Compiling Nginx with LibreSSL (http2/Brotli)
#!/usr/bin/env bash
# names of latest versions of each package
export NGINX_VERSION=1.11.5
export VERSION_PCRE=pcre-8.38
export VERSION_LIBRESSL=libressl-2.4.1
export VERSION_NGINX=nginx-$NGINX_VERSION
export NGX_BROTLI_STATIC_MODULE_ONLY=1
#export NPS_VERSION=1.9.32.10
#export VERSION_PAGESPEED=v${NPS_VERSION}-beta
@ssskip
ssskip / directives.js
Last active March 17, 2016 09:25
form validation
angular.module("kp.account")
/**
* @ngdoc directive
* @name kp.account.directive:kpNicknameValidation
* @description
* Defines validNickname method.
* length between 5-20,less than 5 digit numbers
*/
.directive("kpNicknameValidation", function() {
return {
@ssskip
ssskip / python.md
Last active January 7, 2016 04:19
interview

#Basic

  • Explain the dictionary in Python(简单介绍下 python 里的字典).
  • How do we share global variables across modules in Python? (怎么在不同模块里共享一个全局变量?)
  • How do I convert a string to a number? (怎么把一个字符串转为数字型?)
  • how to read a 8GB file in python? (你会用什么样的方式读取一个8G文件?)
  • Do you know the difference between range and xrange? (range 和 xrange 的区别?)
  • os.path.dirname() & os.path.basename() (这两个方法的区别?)
  • Making a list with unique element from a list with duplicate elements (怎么给一个可能有重复元素的数组去重?)
  • mutable vs immutable (简单阐述 可变 和 不可变)
@ssskip
ssskip / supervisord.service
Last active August 29, 2015 14:26 — forked from tonyseek/supervisord.service
Running supervisord with systemd.
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
ExecReload=/usr/bin/supervisorctl reload
ExecStop=/usr/bin/supervisorctl shutdown
@ssskip
ssskip / nginx.conf
Last active August 29, 2015 14:25 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers
@ssskip
ssskip / mime.types
Created July 9, 2015 03:53
mime.types with woff2 support
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
application/x-font-woff woff;
@ssskip
ssskip / query_table_size_in_db
Created February 2, 2015 06:29
query table size in db
SELECT table_name AS "table",
round(((data_length + index_length) / 1024 / 1024), 2) "size(MB)"
FROM information_schema.TABLES
WHERE table_schema = "$dbName"
ORDER BY (data_length + index_length) DESC;
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0
-A INPUT -i lo -j ACCEPT
-A INPUT ! -i lo -d 127.0.0.0/8 -j REJECT