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
#!/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
#!/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
#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
#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
#coding: utf-8 | |
# python 3 | |
# This script is an editor action, called "Serve Files." It has three improvements over existing implementations: | |
# Serve every file from the directory of your script at its filename | |
# Serve a zip of the entire directory in which your script is contained at /. This is useful for copying a lot of files to a computer at once | |
# Printing your local IP to the console, to make it easier to see where you should go on your computer | |
# It will also clean up the zip it creates after you stop the server. | |
import os | |
import shutil |
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
# virtualenvwrapper | |
# lazy loading saves on shell startup time | |
workon() { | |
[ -z "$PROJECT_HOME" ] && { | |
unset -f workon; | |
export WORKON_HOME=$HOME/.virtualenvs; | |
export PROJECT_HOME=$HOME/Documents/Python; | |
source /usr/local/bin/virtualenvwrapper.sh | |
} | |
workon "$@" |
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 input is not in {{}, {""}, ""} then | |
tell application "Finder" | |
set my_file to first item of input | |
set filetype to (kind of (info for my_file)) | |
-- Treats OS X applications as files. To treat them as folders, integrate this SO answer: | |
-- http://stackoverflow.com/a/6881524/640517 | |
if filetype is "Folder" or filetype is "Volume" then | |
set dir_path to quoted form of (POSIX path of my_file) | |
else |
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 | |
# open current folder in Finder | |
osascript -e'on run {arg} | |
set the_folder to POSIX file (POSIX path of arg) | |
tell application "Finder" | |
activate | |
if exists window 1 then | |
set target of window 1 to the_folder | |
else |
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/perl | |
use strict; | |
use warnings; | |
use feature qw(say); | |
use Color::ANSI::Util qw( | |
rgb_to_ansi256 | |
); | |
say "Throw me hex# and I will throw back ansi 256 color"; |