This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Connect to WiFi network | |
WIFI:T:WPA2;S:MyNetworkName;P:ThisIsMyPassword;H:true; | |
T:WPA2 - Authentication type; can be WEP or WPA, or leave empty for no password. | |
S:MyNetworkName - Network SSID. Required. | |
P:ThisIsMyPassword - Password, ignored if T is left blank. | |
H:true - Optional. True if the network SSID is hidden. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Как быстро и безопасно управлять переменными окружения на macOS с помощью keychain. | |
По сути там уже все есть, нужно только добавить обертку. | |
Делаем раз: | |
tee ~/keychain-env.sh <<'EOF' | |
function keychain-env-read () { | |
security find-generic-password -w -a ${USER} -D "environment variable" -s "${1}" | |
} | |
function keychain-env-add () { | |
[ -n "$1" ] || print "Missing environment variable name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# UPDATED 17 February 2019 | |
# Redirect all HTTP traffic to HTTPS | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name www.domain.com domain.com; | |
return 301 https://$host$request_uri; | |
} | |
# SSL configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -O -L https://kent.dl.sourceforge.net/project/sshpass/sshpass/1.06/sshpass-1.06.tar.gz | |
tar xvzf sshpass-1.06.tar.gz | |
cd sshpass-1.06/ | |
./configure | |
make | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# INCORRECT! DON'T DO THIS! | |
>>> x = "www.Alliancefrançaise.nu" # This is the problematic line. Forgot to make this a Unicode string. | |
>>> print x | |
www.Alliancefrançaise.nu | |
>>> x.encode('punycode') | |
'www.Alliancefranaise.nu-h1a31e' | |
>>> x.encode('punycode').decode('punycode') | |
u'www.Alliancefran\xc3\xa7aise.nu' | |
>>> print x.encode('punycode').decode('punycode') | |
www.Alliancefrançaise.nu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# implementation of Telegram site authorization checking algorithm | |
# for more information https://core.telegram.org/widgets/login#checking-authorization | |
import collections | |
import hmac | |
import hashlib | |
def check_string(d, token): | |
secret = hashlib.sha256() | |
secret.update(token.encode('utf-8')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
log /dev/log local0 notice | |
pidfile /var/run/haproxy.pid | |
maxconn 4000 | |
user haproxy | |
group haproxy | |
daemon | |
stats socket /var/lib/haproxy/stats | |
listen mysql-corp 0.0.0.0:3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ip2hex(cidr, router): | |
addr, mask = cidr.split("/") | |
mask = int(mask) | |
addr = [("%2s" % hex(int(i))[2:]).replace(" ", "0") for i in addr.split(".") if i != "0"] | |
parts = mask / 8 - len(addr) | |
if mask % 8 > 0: | |
parts += 1 | |
if parts > 0: | |
for i in range(int(parts)): | |
addr.append("00") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python | |
from logging import getLogger | |
from logging.config import dictConfig | |
LOGGING = { | |
'version': 1, | |
'disable_existing_loggers': False, | |
'formatters': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pessom@web:/etc/systemd/system$ cat send_top.service | |
#Ansible managed | |
[Unit] | |
Description=Run send_top scripts initialise timer | |
After=network.target | |
[Service] | |
User=root | |
Group=root |
NewerOlder