This file contains hidden or 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/env zsh | |
# using GNU utils so not completely portable | |
# sort -h [compare human readable numbers] works only with gnu sort | |
# also gfind ... -delete, numfmt are GNU utils | |
# terminal-notifier, polipo - must be in the path | |
# For the reference | |
# gfind -mtime means that the content was modified. This date can be manually changed (e.g. with touch). | |
# gfind -ctime means that either the content was changed, or the file's metadata (permission, owner, etc). | |
# -mtime n | |
# evaluate as true if the file modification time subtracted |
This file contains hidden or 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
Show hidden characters
{ | |
"browsers_list": ["macosx","firefox", "safari"], | |
"definitions": | |
{ | |
"!g": { | |
"type": "duckduckgo", | |
"caption": "Google Search" | |
}, | |
"!gist": { | |
"type": "duckduckgo", |
This file contains hidden or 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/env python | |
# Takes converted for privoxy (wrongly*) easylist/easyprivacy action file | |
# and extracts list of adresses that privoxy should block | |
# See https://github.com/Andrwe/privoxy-blocklist | |
# and my | |
# (*) privoxy won't interpret '\.' as regex escape in hostnames | |
import re | |
import os | |
host_pattern = re.compile( |
This file contains hidden or 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/env python | |
# Takes amalgamated hosts file and converts to privoxy action file | |
# so you could block malicious hosts via proxy rather then /etc/hosts file | |
# See http://www.privoxy.org/faq/misc.html#HOSTSFILE | |
# | |
import re | |
import os | |
badguys_pattern = re.compile( | |
'^0.0.0.0(\s*|\t*)(.*)\n|^127.0.0.1(\s*|\t*)(.*)\n') |
This file contains hidden or 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/env zsh | |
# idea came from here: | |
# http://blog.felipe-alfaro.com/2015/03/05/tor-with-brew-in-mac-os-x/ | |
# and some ideas from here: | |
# https://kremalicious.com/simple-tor-setup-on-mac-os-x/ | |
# setting up Sleepwatcher best described here: | |
# https://www.kodiakskorner.com/log/258 | |
function usage() { |
This file contains hidden or 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/env zsh | |
# The mkt parameter determines which Bing market you would like to | |
# obtain your images from. | |
# Valid values are: en-US, zh-CN, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA. | |
# | |
# The idx parameter determines where to start from. 0 is the current day, | |
# 1 the previous day, etc. | |
#IDX=1 | |
for IDX in 0 1 2 |
This file contains hidden or 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
#coding: utf-8 | |
#translates using Google Translate via web | |
import requests | |
import re | |
import clipboard | |
from bs4 import BeautifulSoup | |
def translate(phrase): | |
if phrase == '': | |
raise Exception('Nothing found in clipboard') |
This file contains hidden or 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
#coding: utf-8 | |
#shortens urls from clipboard using bitly | |
import sys | |
import requests | |
import re | |
import clipboard | |
import keychain | |
def shorten(long_url, token): | |
if re.match('\w{40,40}', token): |
This file contains hidden or 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
#http://stackoverflow.com/questions/28252442/speeding-up-this-python-code-for-large-input/28261161#28261161 | |
from bitarray import BitArray | |
from random import randint | |
import numpy as np | |
def SplitArray(l, r): | |
while(l < r): | |
k = randint(l, r) | |
arr.set_bit(k) | |
return SplitArray(l, k-2) + [k] + SplitArray(k+2, r) |
This file contains hidden or 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
#coding: utf-8 | |
from operator import mul | |
import console | |
console.clear() | |
print 'Generating plot... (this may take a little while)' | |
import numpy as np | |
import matplotlib.pyplot as plt | |
GAMMA = 0.57721566490153286061 |