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 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 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
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 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
#!/bin/bash | |
# It is complicated - not my fault. It's Apple implementing changes in launchctl on 10.10, 10.11 | |
# This script restarts Polipo service (as user not root) after connectiong to VPN via Tunnelblick | |
# The reason for this restart is that when on Public WiFi connections are blocked by LittleSnitch (firewall) | |
# Polipo goes crazy waiting for all these connections that disappeared in a black hole | |
# 'Couldn't establish listening socket: Too many open files' | |
# So it is better to start clean after getting VPN connection and I am too lazy to do that from commandline. | |
# Some explanations of why all this is necessary | |
# http://apple.stackexchange.com/questions/195445/ |
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 | |
# MODIFY SETTINGS VIA THE CONFIGURATION FILES IN | |
# conf/ | |
# eval PATH=/opt/usr/sbin:/opt/etc/init.d:$PATH | |
# CHECK FOR NEEDED AND OPTIONAL UTILITIES AND PERMISSIONS | |
# if [ `whoami` != "root" ]; then | |
# echo "Insufficient permissions. Run as root." |
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 | |
# send Pushover notifications | |
import requests | |
import keychain | |
def pushNotification(message, title='', url='', url_title=''): | |
pushover_url = 'https://api.pushover.net/1/messages.json' | |
payload = { | |
'token': keychain.get_password('Pushover', '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
on run {input, parameters} | |
if application "Google Chrome" is running then | |
tell application "Google Chrome" to tell window 1 to close (tabs whose id is not (get id of active tab)) | |
tell application "Google Chrome" | |
tell window 1 to make new tab with properties {URL:"http://localhost:8123/Chrome.html"} | |
end tell | |
else | |
do shell script "open -n -a 'Google Chrome' --args --disable-async-dns" | |
end if | |
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 hosts file and converts to DNSCrypt blacklist-domains file | |
# so you could block malicious hosts on DNSCrypt | |
# (when alternating to DNSCrypt instead of dnsmasq in my scenario) | |
# hosts file from https://github.com/StevenBlack/hosts | |
# See https://dnscrypt.org/ IP/domain names blocking | |
import re |