Skip to content

Instantly share code, notes, and snippets.

@anjia0532
anjia0532 / ip_blacklist.lua
Created May 24, 2017 15:10 — forked from chrisboulton/ip_blacklist.lua
Redis based IP blacklist for Nginx (LUA)
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@anjia0532
anjia0532 / openresty
Last active September 5, 2017 07:36
openresty init.d script
#!/bin/sh
### BEGIN INIT INFO
# Provides: openresty
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts openresty
# Description: starts openresty using start-stop-daemon
### END INIT INFO
@anjia0532
anjia0532 / nginx
Created September 5, 2017 07:59
nginx init.d script
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $network $remote_fs $local_fs
# Required-Stop: $network $remote_fs $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Stop/start nginx
### END INIT INFO
@anjia0532
anjia0532 / ks.cfg.trusty
Created March 15, 2018 00:43 — forked from chusiang/ks.cfg.trusty
Kickstart script for Ubuntu 14.04
# ====================================================================
# Author: 凍仁翔 / chusiang.lai (at) gmail.com
# Blog: http://note.drx.tw
# Filename: ks.cfg.
# Modified: 2015-02-25 10:20
# Description: Kickstart Configurator for Ubuntu 14.04.1 LTS server (amd64)
# Reference:
#
# 1. 作業系統自動安裝應答 CD 製作 - kickstart | iThome Download
# - http://download.ithome.com.tw/article/index/id/1792
@anjia0532
anjia0532 / rancher2.1.1.md
Last active October 26, 2018 05:42
rancher2.1.1.md

1. vmware 12 安装 ubuntu x64 16.04.4 LTS(单机安装) 4U16G50G

2. vmware 12 静默安装Ubuntu

3. ## 远程公司电脑,不知道为嘛无法复制。。。。明天再补充

4. 步骤完全按照 https://www.cnrancher.com/docs/rancher/v2.x/cn/installation/basic-environment-configuration/ 走的,包括最佳实践里的步骤

5. 之前在群里反馈过,coreos-etcd一直在restart ,通过logs -f 看,etcdserver/membership: cluster cannot be downgraded (current version: 3.2.24 is lower than determined cluster version: 3.3).k8s集群用了1.12 1.11 1.10都这样

6. 是不是不能在单台上运行?

@anjia0532
anjia0532 / lua-resty-maxminddb.lua
Created December 7, 2018 00:10
lua-resty-maxminddb.lua
-- Copyright (C) Anjia (anjia0532)
local json = require('cjson')
local json_encode = json.encode
local json_decode = json.decode
local ngx_log = ngx.log
local ngx_ERR = ngx.ERR
local ngx_CRIT = ngx.CRIT
local ngx_INFO = ngx.INFO
{
"福建省": {
"南平市": {
"松溪县": {
"code": "350724",
"level": 3,
"parentCode": "350000",
"name": "松溪县",
"lon": 118.765689,
"lat": 27.610704
@anjia0532
anjia0532 / nexus_docker_image_clean.py
Last active July 11, 2019 08:14
auto clean more than 30 unused docker image https://stackoverflow.com/a/46481098/7001350
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# python2.7
from requests import Request, Session
from requests.exceptions import RequestException
from datetime import datetime,timedelta
import base64
import json
import sys
# -*- coding: utf-8 -*-
# Author AnJia(anjia0532@gmail.com https://anjia0532.github.io)
import argparse
import sys, os
import io
reload(sys)
sys.setdefaultencoding('utf8')
black_dict={"\\":"","\"":""}
def main():
@anjia0532
anjia0532 / Activate Office 2019 for macOS VoL.md
Created June 7, 2021 05:53 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref