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 | |
#python 3 | |
from __future__ import absolute_import | |
import keychain | |
import requests | |
from urllib.parse import quote | |
import os | |
import ui |
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
#scraps text from web page, puts in new Draft | |
import sys | |
import requests | |
import html2text | |
import clipboard | |
import webbrowser | |
import urllib | |
def get_page(url): | |
try: |
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 python3 | |
# coding: utf-8 | |
# various algos counting prime numbers < N | |
# each better or more pythonic then previous | |
import itertools | |
import numpy as np | |
import datetime | |
from operator import mul | |
from functools import reduce |
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 | |
echo "I feel like napping right now..." | |
echo $(date +"%c") | |
ADAPTER=$(networksetup -listallhardwareports | grep -A1 Wi-Fi | awk '/Device:/ {print $2}') | |
CONN=$(networksetup -getairportnetwork "$ADAPTER") | |
echo "$CONN" | |
# switch OFF WiFi first | |
networksetup -setairportpower "$ADAPTER" off |
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 | |
echo "I've been napping. Waking up now..." | |
echo $(date +"%c") | |
# Switch WiFi ON | |
# ADAPTER=en0 | |
ADAPTER=$(networksetup -listallhardwareports | grep -A1 Wi-Fi | awk '/Device:/ {print $2}') | |
echo "$ADAPTER" | |
# check wifi MAC | |
MAC=$(/usr/local/bin/spoof-mac list --wifi) |
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 |
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
# 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
#!/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
#!/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/ |