Skip to content

Instantly share code, notes, and snippets.

@fogmoon
fogmoon / test_kill.ini
Created April 21, 2020 14:38 — forked from ultrabug/test_kill.ini
uwsgi-2.0.x emperor not killing spooler processes example code and ini
[uwsgi]
plugins = python27
socket = 127.0.0.1:3090
master = true
enable-threads = true
log-syslog = uwsgi.test
disable-logging = true
# get total requests by status code
awk '{print $9}' /var/log/nginx/access.log | sort | uniq -c | sort -rn
# get top requesters by IP
awk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head | awk -v OFS='\t' '{"host " $2 | getline ip; print $0, ip}'
# get top requesters by user agent
awk -F'"' '{print $6}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
# get top requests by URL
@fogmoon
fogmoon / .gitignore
Created June 5, 2020 12:55 — forked from gregplaysguitar/.gitignore
Some simple Ubuntu server monitoring tools
*.pyc
conf.py
@fogmoon
fogmoon / nginxproxy.md
Created August 23, 2020 17:49 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@fogmoon
fogmoon / iterm2.zsh
Created October 12, 2020 18:44 — forked from wadey/iterm2.zsh
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 tab color commands
# https://iterm2.com/documentation-escape-codes.html
if [[ -n "$ITERM_SESSION_ID" ]]; then
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
@fogmoon
fogmoon / README.md
Created November 7, 2020 06:06 — forked from chuyik/README.md
macOS 给 Git(Github) 设置代理(HTTP/SSH)
@fogmoon
fogmoon / Rinkeby.md
Created August 25, 2021 05:39 — forked from learner-long-life/Rinkeby.md
How to get on Rinkeby Testnet in less than 10 minutes

How to get on Rinkeby Testnet in less than 10 minutes

Following instructions from the excellent https://www.rinkeby.io/

Synchronizing a Full Node

A full node lets you access all state. There is a light node (state-on-demand) and wallet-only (no state) instructions as well,

@fogmoon
fogmoon / split-pull-requests.md
Created January 7, 2022 06:51 — forked from loilo/split-pull-requests.md
Split a large pull request into two
@fogmoon
fogmoon / supervisor.conf
Created February 22, 2022 08:49 — forked from tsabat/supervisor.conf
Sample supervisor config file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@fogmoon
fogmoon / README.md
Created February 24, 2022 15:41 — forked from tpitale/README.md
Sublime Text plugin to create a simple timestamp
  1. Go to Tools > New Plugin
  2. Paste timestamp.py contents and save in User as timestamp.py
  3. Open Preferences > Key Bindings - User (or Default, your call)
  4. Paste keybindings.json, or add a line to your keybindings
  5. Customize the keyboard shortcut to your liking and save