Skip to content

Instantly share code, notes, and snippets.

View joshbode's full-sized avatar

Josh Bode joshbode

  • Melbourne, Victoria, Australia
View GitHub Profile
@Steve-Tech
Steve-Tech / TelstraAirConnect.py
Last active August 22, 2020 01:24
Python Telstra Air Connector
import requests
import re
session = requests.Session()
# This isn't your Telstra ID but rather the Fon credentials found in the Telstra Air app, you can also find this in the network tab of inspect element when logging in normally.
anid = "m61400000000@wifi.telstra.com"
anidpassword = ""
try: login = re.findall(r'<LoginURL>(.*)</LoginURL>', session.get("http://msftconnecttest.com/redirect").text)[0] # Get the Telstra Air login URL
@bluca
bluca / gist:5028bae1768c01d587dabe51f7877750
Created December 16, 2016 16:41
python zmq unit test mock
import zmq
import unittest
from unittest.mock import patch
from unittest.mock import MagicMock
class MockZmqSocket(MagicMock):
def __init__(self, **kwds):
super().__init__(**kwds)
@trestletech
trestletech / server.R
Last active May 25, 2017 21:30
An example of doing prolonged, iterative computation in Shiny.
library(shiny)
shinyServer(function(input, output, session) {
# The number of iterations to perform
maxIter <- 50
# Track the start and elapsed time
startTime <- Sys.time()
output$elapsed <- renderText({
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@ju-popov
ju-popov / timestamp.py
Last active April 7, 2021 16:09
Python DateTime / Timestamp Convertion
######################################################################
# CURRENT AWARE LOCAL DATETIME
######################################################################
from datetime import datetime
from tzlocal import get_localzone
local_tz = get_localzone()
local_dt = datetime.now(local_tz)
@joshbode
joshbode / pmr.r
Last active December 13, 2015 23:59
Sub-totals for ddply
# poor-man's rollup
# rollups like in SQL: GROUP BY ROLLUP(...)
# example:
# d = data.frame(x=trunc(runif(25, 1, 10)), y=trunc(runif(25, 1, 5)), z=rnorm(25))
# result = pmr(d, .(x, y, j=x / 2), summarise, p=sum(z), .labels=list(x='-900', y='Total'))
require(plyr)
pmr = function(.data, .variables, ...,