Skip to content

Instantly share code, notes, and snippets.

View JamieMagee's full-sized avatar
💪

Jamie Magee JamieMagee

💪
View GitHub Profile
@JamieMagee
JamieMagee / nationalrail.coffee
Last active December 21, 2015 13:38
A hubot script to fetch live departure times from the National Rail website
# Description:
# Get National Rail live departure information
#
# Dependencies:
# None
#
# Configuration:
# HUBOT_DEFAULT_STATION - set the default from station (nearest to your home/office)
#
# Commands:
fns = players.map (player) ->
(cb) ->
msg.http("http://pwa.wp3.pl/curvefever/?player=" + player).get() (err, res, body) ->
$ = cheerio.load(body)
results.push
name: $("b").slice(0).eq(0).text().toLowerCase()
rank: parseInt($("td").slice(37).eq(0).text(), 10)
cb()
async.parallel fns, ->
results.sort (x,y) -> y.rank - x.rank
@JamieMagee
JamieMagee / scarves.py
Last active August 29, 2015 14:00
Scrape Cambridge College scarves from Wikipedia
from bs4 import BeautifulSoup
import urllib.request as request
import re
url = 'https://en.wikipedia.org/wiki/Colleges_of_the_University_of_Cambridge'
page = request.urlopen(url).read().decode('utf-8')
soup = BeautifulSoup(page)
tables = soup.find_all('table', {'class': 'toccolours'})
f = open('scarves.html', 'wb')
reg = re.compile('font-size:50%;')
@JamieMagee
JamieMagee / solution.c
Created July 31, 2014 16:41
Interview Question
#include <stdio.h>
int main()
{
printf("%i\n", solution("asdfdsa\0"));
printf("%i\n", solution("asddsa\0"));
printf("%i\n", solution("a\0"));
printf("%i\n", solution("ac\0"));
}
# general
(gen) banner: SSH-2.0-dropbear_2016.74
(gen) software: Dropbear SSH 2016.74
(gen) compatibility: OpenSSH 6.5-6.6, Dropbear SSH 2013.62-2014.66
(gen) compression: disabled
# key exchange algorithms
(kex) [email protected] -- [info] available since OpenSSH 6.5, Dropbear SSH 2013.62
(kex) ecdh-sha2-nistp521 -- [fail] using weak elliptic curves
`- [info] available since OpenSSH 5.7, Dropbear SSH 2013.62

Keybase proof

I hereby claim:

  • I am jamiemagee on github.
  • I am jammie (https://keybase.io/jammie) on keybase.
  • I have a public key ASAZjkFufFnZnHVIthb9-qV-mOw0aaFeTq96gr8y6-GLmgo

To claim this, I am signing this object:

val doc = Jsoup.connect("https://twitter.com").get()
val initData = doc.select("#init-data").attr("value")
val json = Parser().parse(StringReader(initData)) as JsonObject
val hashFlagsJson = json {
obj(
"hashflagBaseUrl" to json.string("hashflagBaseUrl"),
"activeHashflags" to json["activeHashflags"] as JsonObject
)
}
@JamieMagee
JamieMagee / .gitconfig
Last active March 15, 2018 09:12
Change git user automatically depending on directory
[alias]
# Manage git user identities
work = "!f() { git config --local user.email \"[email protected]\"; }; f"
personal = "!f() { git config --local user.email \"[email protected]\"; }; f"
whoami = !sh -c 'echo \"$(git config --get user.name) <$(git config --get user.email)>\"'
#!/bin/bash
# Event Ids
# 3898 - Copenhagen Half Marathon 2018
# 3896 - Royal Run 2018
# 4217 - Copenhagen Marathon 2019
if [ "$#" -ne 2 ]; then
echo "Event ID and runner number required"
exit 1
@JamieMagee
JamieMagee / Update-AUPackages.md
Last active October 15, 2021 00:06
Update-AUPackages Report #powershell #chocolatey