Skip to content

Instantly share code, notes, and snippets.

View nosun's full-sized avatar
🏠
Working from home

郭华伟 nosun

🏠
Working from home
View GitHub Profile
@nosun
nosun / ip_blacklist.lua
Created March 21, 2023 13:18 — 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:
@nosun
nosun / nginx.time.conf
Created December 28, 2018 04:52 — forked from eagleon/nginx.time.conf
Nginx expire 时间单位
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
etag off; #关闭etag
expires 1d; #有效期一天
# expires的单位可以使用
# ms: 毫秒
# s: 秒
# m: 分钟
# h: 小时
# d: 天
# w: 星期
@nosun
nosun / nginx-cache-purge.lua
Last active January 4, 2023 19:00 — forked from titpetric/purge-multi.lua
Delete NGINX cached items with a PURGE with wildcard support
-- Tit Petric, Monotek d.o.o., Tue 03 Jan 2017 06:54:56 PM CET
--
-- Delete nginx cached assets with a PURGE request against an endpoint
-- supports extended regular expression PURGE requests (/upload/.*)
-- combine single,all,match three mode
-- updated by nosun nosun2008@126.com
local md5 = require 'md5'
function file_exists(name)
@nosun
nosun / spotify.py
Created February 3, 2018 09:33 — forked from jorgebastida/spotify.py
Rudimentary Spotify Web Proxy using mitmproxy
#!/usr/bin/env python
"""
Rudimentary Spotify Web Proxy using mitmproxy.
Use it by your own responsibility!!
This was only entertainment!!
"""
import random
import hashlib
@nosun
nosun / tmux-cheatsheet.markdown
Created January 25, 2018 06:43 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@nosun
nosun / jupyter_shortcuts.md
Created October 16, 2017 22:52 — forked from kidpixo/jupyter_shortcuts.md
Keyboard shortcuts for ipython notebook 3.1.0 / jupyter

Toc

Keyboard shortcuts

The IPython Notebook has two different keyboard input modes. Edit mode allows you to type code/text into a cell and is indicated by a green cell border. Command mode binds the keyboard to notebook level actions and is indicated by a grey cell border.

MacOS modifier keys:

  • ⌘ : Command
@nosun
nosun / api.example.net.conf
Created August 22, 2017 06:52 — forked from mrluanma/api.example.net.conf
cache POST request with Nginx
upstream api_example_net {
server api.example.net:4000;
keepalive 600;
}
proxy_cache_path /var/cache/nginx/tag levels=1:2 keys_zone=tag:10m inactive=1d max_size=10g;
server {
listen 80;
server_name api.example.net;
@nosun
nosun / logstash-grok-pattern
Last active August 15, 2017 03:50
logstash-grok-pattern
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
EMAILLOCALPART [a-zA-Z][a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILLOCALPART}@%{HOSTNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
@nosun
nosun / weixin.md
Created May 9, 2017 07:12 — forked from Josscii/weixin.md
wechat_spider 原理扫盲帖

wechat_spider 原理扫盲帖

这篇文章旨在为刚接触 wechat_spider 的人提供一个快速了解这个项目基本原理的途径。

思路

首先我们随便进入一个微信公众号详情页。

@nosun
nosun / exercise.tour.go
Created April 14, 2017 09:22 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)