Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Not again!

Seamus seamusdemora

💭
Not again!
View GitHub Profile
@seamusdemora
seamusdemora / gist:74c44f17938d2f78b3d0c57aa5f6f905
Created March 31, 2018 19:19 — forked from NonaSuomy/gist:a62a9a125d61fc5df748066961702ac6
Get OAUTH2.0 access token for Google Voice with a shell-script
View gist:74c44f17938d2f78b3d0c57aa5f6f905
#!/bin/bash
##
## Authenticate with Google Voice
##
USAGE="`basename $0` {auth|refresh|token} ctx"
CTX_DIR=$HOME/.gvauth
CLIENT_ID="YOUR_CLIENTID_FROM_GOOGLE_DEVELOPER_CONSOLE"
CLIENT_SECRET="YOUR_CLIENTSECRET_FROM_GOOGLE_DEVELOPER_CONSOLE"
SCOPE="https://www.googleapis.com/auth/googletalk%20https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile"
@seamusdemora
seamusdemora / weather_current.py
Created April 19, 2018 00:46 — forked from nick3499/weather_current.py
Python 3: Dark Sky API: Print Weather Data from JSON Glob: urllib3, simplejson, datetime
View weather_current.py
#!/usr/bin/env python3
import urllib3 as ul3
import simplejson as json
import datetime
ul3.disable_warnings(ul3.exceptions.InsecureRequestWarning)
k = 'abcd00efga2bc13abcd2c847362y876x' # API key
c = '40.7306, -73.9352' # geo coords
@seamusdemora
seamusdemora / convert_utf8.sh
Last active April 19, 2018 19:48
UTF-8 Text Filter for BBEdit
View convert_utf8.sh
#!/bin/bash
# launch AppleScript to retrieve filename of file to
# be converted and store the result in `file_to_change`
file_to_change=$(/usr/bin/osascript << EOT
tell app "BBEdit"
set filePath1 to file of document 1
set filePath2 to POSIX path of filePath1
end
View trash
#!/usr/bin/env python
import os
import sys
import subprocess
if len(sys.argv) > 1:
files = []
for arg in sys.argv[1:]:
if os.path.exists(arg):
p = os.path.abspath(arg).replace('\\', '\\\\').replace('"', '\\"')
@seamusdemora
seamusdemora / bash-script-git.sh
Created March 15, 2020 10:21 — forked from salcode/bash-script-git.sh
Notes for bash scripting git commands
View bash-script-git.sh
# Current branch - Determine current git branch, store in $currentbranch, and exit if not on a branch
if ! currentbranch=$(git symbolic-ref --short -q HEAD)
then
echo We are not currently on a branch.
exit 1
fi
# Uncommited Changes - Exit script if there uncommited changes
if ! git diff-index --quiet HEAD --; then
echo "There are uncommited changes on this repository."
View better_history.sh
# Custom history configuration
# Run script using:
# chmod u+x better_history.sh
# sudo su
# ./better_history.sh
echo ">>> Starting"
echo ">>> Loading configuration into /etc/bash.bashrc"
echo "HISTTIMEFORMAT='%F %T '" >> /etc/bash.bashrc
echo 'HISTFILESIZE=-1' >> /etc/bash.bashrc
View raspberry-disable-ipv6.md