Skip to content

Instantly share code, notes, and snippets.

View PetraOleum's full-sized avatar

Petra Lamborn PetraOleum

View GitHub Profile
@PetraOleum
PetraOleum / setupclient.py
Created May 30, 2020 00:33
Mastodon.py secret generation script
# Mastodon.py client setup
# Install mastodon module with pip install --user Mastodon.py or equiv
# See https://mastodonpy.readthedocs.io/en/stable/ for more information
from getpass import getpass
from mastodon import Mastodon
import argparse
parser = argparse.ArgumentParser(description = ("Generate secret file "
"for mastodon.py api"))
parser.add_argument("name", help="Name of app, e.g. mybot")
@PetraOleum
PetraOleum / hostcomp
Created April 13, 2020 23:03
N4L blocks
#! /bin/bash
# Compare dns results between two servers
DNS1=192.168.1.1
DNS2=23.216.52.39
diff -y --color=always <(host -t a "$1" "$DNS1") <(host -t a "$1" "$DNS2")
@PetraOleum
PetraOleum / NZHolidays.R
Created October 24, 2018 04:16
Rstats functions for calculating if a specified date is a public holiday in New Zealand
# Functions to calculate if a date
# is a holiday or weekend.
# Functions are vectorised, so can
# be used with columns of dates.
# Note: Holidays are mondayised if they fall on weekends
# and the Saturday/Sunday parts of Easter are excluded.
# Change the code if this is not the way you want it to work.
# Note: Mondayisation for ANZAC and Waitangi were introduced
#! /usr/bin/env Rscript
# This script scrapes the table from http://www.centralpho.org.nz/PracticesandFees, geocodes it, and then saves to ../data
url <- "http://www.centralpho.org.nz/PracticesandFees"
xpath <- '//*[@id="dnn_ctr700_View_PracticeGrid"]'
library(rvest)
table <- url %>% html() %>% html_nodes(xpath=xpath) %>% html_table()