Skip to content

Instantly share code, notes, and snippets.

View tom-henderson's full-sized avatar
🇳🇿

Tom Henderson tom-henderson

🇳🇿
View GitHub Profile
code latitude longitude name
AD 42.546245 1.601554 Andorra
AE 23.424076 53.847818 United Arab Emirates
AF 33.93911 67.709953 Afghanistan
AG 17.060816 -61.796428 Antigua and Barbuda
AI 18.220554 -63.068615 Anguilla
AL 41.153332 20.168331 Albania
AM 40.069099 45.038189 Armenia
AN 12.226079 -69.060087 Netherlands Antilles
AO -11.202692 17.873887 Angola
export PYTHONDONTWRITEBYTECODE=1
function Get-GPClientSideExtensions {
Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\GPExtensions" | foreach {
$guid = ($_.Name).Split(“\”) | Select -Last 1
$props = Get-ItemProperty $_.PSPath
# Guessing CSE name in order (default), ProcessGroupPolicy, ProcessGroupPolicyEx
if ($props.'(default)') {
$description = $props.'(default)'
} elseif ($props.ProcessGroupPolicy) {
$description = $props.ProcessGroupPolicy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.observium.agent</string>
<key>Program</key>
<string>/usr/local/lib/observium-agent/yoctopuce</string>
<key>Sockets</key>
<dict>
set vpn ipsec ipsec-interfaces interface pppoe0
set vpn ipsec auto-firewall-nat-exclude enable
set vpn ipsec nat-traversal enable
set vpn ipsec esp-group esp-azure compression disable
set vpn ipsec esp-group esp-azure lifetime 3600
set vpn ipsec esp-group esp-azure mode tunnel
set vpn ipsec esp-group esp-azure pfs disable
set vpn ipsec esp-group esp-azure proposal 1 encryption aes256
set vpn ipsec esp-group esp-azure proposal 1 hash sha1
import requests
url = "https://api-dot-translate-safeswim.appspot.com/v1/locations/4829360"
data = json.loads(requests.get(url))
days = [
'today',
'tomorrow',
'dayAfter'
]
class Delta:
def __init__(self,old,new):
newset = set(new.rules)
oldset = set(old.rules)
self.deleted = list(oldset - newset)
self.added = list(newset - oldset)
self.retained = list(oldset & newset)
@tom-henderson
tom-henderson / unifi-devices.py
Last active February 7, 2018 10:01
Get a list of connected devices from a Unifi controller
import sys
import json
import requests
def get_clients():
PORTAL_URL = 'https://0.0.0.0:8443/'
PORTAL_LOGIN_PARAMS = {
'username': '',
'password': '',
// Place your settings in this file to overwrite the default settings
{
// General Appearance
"window.zoomLevel": 0,
"workbench.colorTheme": "Tomorrow_Night",
"workbench.iconTheme": "vs-seti",
"workbench.startupEditor": "welcomePage",
// Editor
"editor.selectionHighlight": true,
import requests
from bs4 import BeautifulSoup as bs
locations = ['Devonport', 'Takapuna']
data = {}
for location in locations:
url = "https://www.tenancy.govt.nz/rent-bond-and-bills/market-rent/?location={}".format(location)
html = requests.get(url).text
soup = bs(html, "html.parser")