Skip to content

Instantly share code, notes, and snippets.

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

Vitalii Mikhnevych rooty

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am rooty on github.
  • I am blackrooty (https://keybase.io/blackrooty) on keybase.
  • I have a public key whose fingerprint is 2F76 26F8 2D12 39FE FEE1 4018 794B 25A6 DE73 CA12

To claim this, I am signing this object:

#!/usr/bin/env python
import sys
import urllib2
import urllib
import multiprocessing
import json
import logging
import argparse
import urlparse
@rooty
rooty / cors-nginx.conf
Created September 23, 2017 10:46 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
# Converts a JSONL file generated with telegram-history-dump (1) to CSV
# Usage: python telegram-csv.py <path to json file> <path to output csv file>
# Example: python telegram-csv.py Bob.json Bob.csv
# 1: https://github.com/tvdstaaij/telegram-history-dump
from datetime import datetime
import unicodecsv as csv
import json, sys
def get_isodate(msg):
date = msg.get("date", None)
@rooty
rooty / php_upgrade_to_71.sh
Created November 6, 2017 15:23 — forked from pixeline/php_upgrade_to_71.sh
Update Mac Os X's php version to php 7.1 using homebrew. Includes curl and mcrypt
# 1. Install brew --> http://brew.sh/
# 2. run the following commands in your Terminal
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install --with-openssl curl
brew install --with-homebrew-curl --with-apache php71
brew install php71-mcrypt php71-imagick
# 3. Follow these instructions to make Apache and php-cli use the newer php executable and make the change persist after reboot.
brew info php71
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNgNpJEbZA19a6T+qAlRchIlD7LDCA0fiiUDTtePngq8jR25mNS5Gi6QxgdoSWM9MpXYpzFKr8HbTw7obsW6rd0H/evGvE4fzhdYLLcyZfWc2WAful2/g5ReiojuDT8bBTghI2/2F9zWvtwWttDpgaBbMg7vWtP3qaTSkdgGD4+DhYD9AAz4tKWeoGwbMZpKzFwPiAAVZ+fUg3Xlkilu3iEMVs5m1E/AnI2ZakloBCzitKbrcyys7kPbxd3LdDMxi2F8KvySfwGSYmuJzLUq5PEIPUSZpg7b5/65v4YWPY3fd6k9GTjTt4ZkVasBdb4LHM8rWJgzXbC7xgfC0TPr69
@rooty
rooty / haproxy.cfg
Created November 30, 2017 13:56 — forked from GABeech/haproxy.cfg
Stack Exchange HAProxy
# This is an example of the Stack Exchange Tier 1 HAProxy config
# The only things that have been changed from what we are running are:
# 1. User names have been removed
# 2. All Passwords have been remove
# 3. IPs have been changed to use the example/documentation ranges
# 4. Rate limit numbers have been changed to randome numbers, don't read into them
userlist stats-auth
group admin users $admin_user
user $admin_user insecure-password $some_password
@rooty
rooty / docker-cleanup-resources.md
Created January 2, 2018 10:39 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

netstat -nalp | grep -E ':80 |:443 ' | awk '{print $6}' | sort | uniq -c
308 CLOSE_WAIT
2702 ESTABLISHED
148 FIN_WAIT1
66 FIN_WAIT2
3 LAST_ACK
1 LISTEN
139 SYN_RECV
4 SYN_SENT
351380 TIME_WAIT
#!/bin/sh
MODULES=(
"iptable_nat"
"nf_conntrack"
"nf_conntrack_ipv4"
"nf_defrag_ipv4"
"nf_nat"
"nf_nat_ipv4"
"xt_nat"
"nf_conntrack_netlink"