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 / 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 / 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 / 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 / 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 / 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 / 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 / AWS-ELB-x_real_user_ip.md
Last active November 8, 2017 14:58
Replicate External 5.6 Mysql Slave to AWS RDS (with Replicate Filters)
  1. Update nginx conf (/etc/nginx/nginx.conf)
  http {
    ...
    ...
    real_ip_header X-Forwarded-For; # Get Client IP From X-Forwarded_For
    set_real_ip_from 10.0.0.0/8;  # AWS ELB ip ranges
    ...
...
@ssskip
ssskip / opendkim.conf
Created January 2, 2018 10:00
opendkim
# This is a basic configuration that can easily be adapted to suit a standard
# installation. For more advanced options, see opendkim.conf(5) and/or
# /usr/share/doc/opendkim/examples/opendkim.conf.sample.
# Log to syslog
Syslog yes
# Required to use local socket with MTAs that access the socket as a non-
# privileged user (e.g. Postfix)
UMask 002
@ssskip
ssskip / P12toPEM.txt
Created May 2, 2018 08:13 — forked from shahdhiren/P12toPEM.txt
Convert P12 file for Push Notification to PEM format
Development Phase:
Step 1: Create Certificate .pem from Certificate .p12
Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
Step 2: Create Key .pem from Key .p12
Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
Step 3: Optional (If you want to remove pass phrase asked in second step)
Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
@ssskip
ssskip / README.md
Created December 4, 2018 06:20
open file limit ECS

Configuring Linux usage limits with Docker and AWS ECS

  • ECS TASK Definitions.
"containerDefinitions": [
    {
...
      "ulimits": [
 {