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
#!/bin/bash | |
set -e # all err | |
search_dir=$1 | |
for entry in "$search_dir"/* | |
do | |
new=$(dirname "$entry")/$(basename "$entry").m4a | |
echo "${entry}" | |
new=${new/".flac"/} | |
echo $new |
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
import concurrent.futures | |
import urllib.request | |
import argparse | |
import json | |
import time | |
def make_call(data): | |
headers = data["headers"] | |
uri = data["uri"] |
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
import urllib.request | |
import subprocess | |
import argparse | |
import json | |
def call_github_repos(username, oauth=None, base_url="https://api.github.com"): | |
headers = {"Accept": "application/vnd.github.v3+json"} | |
if oauth: | |
headers["Authorization"] = "token {}".format(oauth) |
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
import random | |
import pprint | |
import copy | |
from collections import defaultdict | |
root_people = [ | |
"P1", | |
"P2", | |
"P3", | |
"P4", |
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
import subprocess | |
import re | |
regex = "(?P<bytes>\d+) bytes from (?P<ip>\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}): icmp_seq=(?P<icmp>\d+) ttl=(?P<ttl>\d+) time=(?P<ms>\d+.\d+) ms" | |
r = re.compile(regex) | |
# compiling ahead of time speeds up other runs when more than one server is needed to be reached | |
def ping_server(ip="localhost", count=10, *args, **kwargs): | |
rtn_list = [] |
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
import urllib2 | |
import random | |
import json | |
import argparse | |
def get_primary(rotation): | |
return rotation[random.randint(0, len(rotation)-1)] | |
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
import ujson as json | |
import argparse | |
import logging | |
logger = logging.getLogger(__name__) | |
def get_json(fn): | |
try: | |
with open(fn) as f: |
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
!/bin/bash | |
X="`/opt/redis/redis-3.0.3/src/redis-cli ping`" | |
echo ${X} | |
while [ "${X}" != "PONG" ]; do | |
echo "redis slave not yet ready" | |
echo "${X}" | |
sleep 30 | |
X="`/opt/redis/redis-3.0.3/src/redis-cli ping`" |
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
#!/bin/bash | |
sudo iptables -A INPUT -i tun+ -j ACCEPT | |
sudo iptables -A FORWARD -i tun+ -j ACCEPT | |
sudo iptables -A FORWARD -i tun+ -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT | |
sudo iptables -A FORWARD -i eth0 -o tun+ -m state --state RELATED,ESTABLISHED -j ACCEPT | |
# be sure to replace 10.8.0.0/24 with whatever is in your settings, this example for default install | |
sudo iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE | |
sudo iptables -A OUTPUT -o tun+ -j ACCEPT |
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
""" | |
The goal here is to create a "switch" like environment to allow for using | |
strings and other representations for dynamic comparison of two values. | |
Uses the operator library: https://docs.python.org/2/library/operator.html | |
""" | |
import operator | |
OPS = { | |
'=': operator.eq, |
NewerOlder