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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
type PackageJson struct { | |
Name string `json:"name"` | |
Dependencies Dependency `json:"dependencies"` |
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
curl -X GET -G --header "Referer: https://nzpost.co.nz" -d q=1%20Watt%20Street,%20Parnell -d public_api_key=245ae700-0800-4344-82dc-46bce23d09e0 https://address.nzpost.co.nz/api/suggest.json | jq '.addresses[0].FullAddress' | rev | cut -c2-5 | rev |
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
import requests | |
import json | |
pocket_consumer_key = "" | |
pocket_access_token = "" | |
larder_key = "" | |
def fetch_pocket(): | |
payload = {'consumer_key': pocket_consumer_key, 'access_token': pocket_access_token, 'state': 'unread'} | |
url = 'https://getpocket.com/v3/get' |
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
from ldap3 import Server, Connection, ALL, ALL_ATTRIBUTES, NTLM, SYNC | |
class LDAPClient: | |
def __init__(self, username, password, base, url): | |
self.username = username | |
self.password = password | |
self.base = base | |
self.url = url | |
self.connection = None |
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
import csv | |
import sys | |
from geojson import LineString, MultiLineString, Feature, GeometryCollection, FeatureCollection, dumps | |
csv.field_size_limit(sys.maxsize) | |
def cleanup_coord_string(shape): | |
if 'MULTILINESTRING' in shape: | |
shape = shape.replace('MULTILINESTRING', '') | |
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
#!/bin/zsh | |
proxy_host="<ip>:<port>" | |
proxy_state="$HOME/.proxy" | |
proxy_script="$HOME/dotfiles/work/proxy.sh" | |
if [[ ! -f $HOME/.proxy ]]; then | |
echo "No proxy state file found." | |
echo "Now creating with default state of 'on'" | |
echo "on" > $HOME/.proxy | |
fi |
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/gawk -f | |
# awk script for converting an iCal formatted file to a sequence of org-mode headings. | |
# this may not work in general but seems to work for day and timed events from Google's | |
# calendar, which is really all I need right now... | |
# | |
# Modified by Marcus Crane <[email protected]> slightly to have a human readable name | |
# | |
# usage: | |
# wget https://<calendar_url>.ics && \ | |
# gawk -v calendar="My calendar" -f THISFILE < ical.ics > calendar.org |
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
from mailbox import MaildirMessage | |
import time | |
from datetime import datetime | |
import os | |
from glob import glob | |
files = glob("*") | |
def update_mod_date(directory): | |
with open(directory, 'r') as f: |
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
""" | |
Roughly based off https://gist.github.com/gbaman/b3137e18c739e0cf98539bf4ec4366ad | |
To grab your access token, log into https://accounts.firefox.com/settings | |
Open your browser dev tools (Right click -> Inspect Element), go to the Network tab | |
and refresh the page to populate the network stream. | |
Click on any one of the POST requests to https://graphql.accounts.firefox.com/graphql | |
and then under the Request Headers portion (at the bottom of the Headers tab), | |
copy the value for the Authorization Header. Just the token, not the Bearer text itself. |
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
from justwatch import JustWatch | |
from pyarr import RadarrAPIv3 | |
client = JustWatch(country='NZ') # change to your country code | |
BASE_URL = 'http://192.168.1.100:7878' | |
API_KEY = '<api_key_here>' | |
FILMS_ON_NETFLIX = {} | |
radarr = RadarrAPIv3(BASE_URL, API_KEY) |