Skip to content

Instantly share code, notes, and snippets.

@tohta
tohta / proxy.pac
Last active May 15, 2021 02:30
Proxy PAC
function FindProxyForURL(url, host) {
return "SOCKS localhost:10080";
}
@tohta
tohta / mas_list_20190531
Last active May 31, 2019 03:37
mas list
896624060 (2.3.8)
439654198 (1.23.1)
430255202 (7.7.7)
1295203466 (10.2.13)
421131143 (1.0.14)
682658836 (10.3.2)
422304217 (1.10.6)
407963104 (3.8.4)
497799835 (10.2.1)
974971992 (1.0.18)
@tohta
tohta / nginx_access_log_20190414
Created April 14, 2019 16:09
nginx access log on 20190414 group by %H
awk -F: '{print $2}' *.log | sort | uniq -c | perl -lane 'printf("%02d: %s (%d)\n", $F[1], "|" x ($F[0]/50000), $F[0])'
00: ||||||||| (470564)
01: |||||| (315551)
02: |||| (206251)
03: ||| (163703)
04: || (131133)
05: ||| (175420)
06: ||||| (290490)
07: |||||||| (444239)
08: ||||||||||| (567029)
# ORD standard rpm spec
# run rpmbuild -bb filename.spec to build the binary rpm
BuildArch: noarch
%define _builddir .
%define _rpmdir ./rpm
%define _summary Example App
%define _broker my_brand
#!/usr/bin/env bash
set -ue
i=$((0))
for n in $(kubectl get -o=custom-columns=NAMESPACE:.metadata.namespace,KIND:.kind,NAME:.metadata.name pv,pvc,configmap,ingress,service,secret,deployment,statefulset,hpa,job,cronjob --all-namespaces | grep -v 'secret/default-token')
do
if (( $i < 1 )); then
namespace=$n
i=$(($i+1))
#!/usr/bin/env bash
# https://docs.microsoft.com/ja-jp/azure/aks/ingress-static-ip
set -ue
# Public IP address of your ingress controller
IP=$1
# Name to associate with public IP address
DNSNAME=$2
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: echo
annotations:
nginx.ingress.kubernetes.io/server-snippet: |
set $agentflag 0;
if ( $http_user_agent ~* "(Mobile)" ){
#!/usr/bin/env python
import sys, unicodedata
for c in sys.stdin.read().decode('utf-8'):
try:
print '%s : %s' % (c, unicodedata.name(c))
except ValueError:
print 'codepoint ', ord(c)
@tohta
tohta / tunnel_keeper.sh
Created April 15, 2017 00:06
recreate ssh tunnel if failed
#!/bin/sh
CMD="ssh -N -L13306:db:3306 bastion"
pgrep -f -x "${CMD}" > /dev/null 2>&1 || ${CMD}
@tohta
tohta / ansible_best_practice_mkdirs
Created April 10, 2017 02:42
ansible best practice: Directory Layout
mkdir -p {production,staging,group_vars,host_vars,library,filter_plugins,webtier,monitoring} roles/common/{tasks,handlers,templates,files,vars,defaults,meta,library,lookup_plugins}