Skip to content

Instantly share code, notes, and snippets.

View owenjones's full-sized avatar

Owen owenjones

  • Bristol, UK
  • 11:22 (UTC +01:00)
View GitHub Profile
@owenjones
owenjones / ipupdate.py
Created October 12, 2018 21:40
Digital Ocean API - Dynamic IP Record Updater
#!/usr/bin/env python3
domain = "" # Root domain
record = "" # Record to update
token = "" # API token (needs write access)
try :
import os.path
from urllib.request import urlopen
from urllib.error import URLError
from base64 import b64decode as decode
@owenjones
owenjones / fuck.c
Last active July 8, 2020 18:11
Brainfuck Interpreter
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define sblock 8 // Stack block length
#define lblock 4 // Loop-stack block length
#define readln 1024 // Length of input buffer
char* reallocate(char* array, int blocks, int blocksize, int loop, int debug) {
// Reallocates the input stack if current length is exceeded
@owenjones
owenjones / blackboard_bookmarklet.js
Created November 30, 2016 23:18
Blackboard Login Bookmarklet
javascript:(function() {
if(window.location.href.indexOf("ole.bris.ac.uk") > 0) {
var redirect = "https://www.ole.bris.ac.uk/webapps/bb-auth-provider-cas-bb_bb60/execute/casLogin?cmd=login&authProviderId=_122_1&redirectUrl=";
window.location.href = redirect + encodeURIComponent(window.location.href);
}
})();
@owenjones
owenjones / ieee_bookmarklet.js
Last active November 30, 2016 17:47
IEEExplore Institutional Login Bookmarklet
javascript:(function(){
if(window.location.href.indexOf("ieeexplore.ieee.org") > 0) {
var loc = encodeURIComponent(window.location.href);
var shib = encodeURIComponent("https://idp.bris.ac.uk/shibboleth");
var next = "http://ieeexplore.ieee.org/servlet/wayf.jsp?entityId=" + shib + "&url=" + loc;
window.location.href = next;
}
})();
@owenjones
owenjones / mergesubs.sh
Last active July 23, 2016 14:53
Merges separate .mkv and .srt files in a folder into a single .mkv
#!/bin/sh
echo ">> Merging .srt into .mkv"
for f in *.mkv
do
echo ">> Merging ${f%.*}"
mkvmerge -o ./merged/${f} ${f} ${f%.*}.srt
done
echo ">> Finished merging"
@owenjones
owenjones / tv-rename.sh
Created July 22, 2016 19:07
Renames tv show file names of the files passed to just SXXEYY.ext
#!/bin/sh
rename 's/(.*)S([0-9]+)E([0-9]+)(.*)([.]{1}[a-z]+)/S$2E$3$5/' $1
@owenjones
owenjones / happybirthday.b
Created November 28, 2014 13:27
Happy Birthday!
++++++[>++++++++++++<-]>.<+++++[>+++++<-]>.<+++[>+++++<-]>..<+++[>+++<-]>.
<+++++++++[>---------<-]>--------.<+++++[>++++++<-]>++++.<+++++[>++++++++<-]>-.
<+++[>+++<-]>.++.<+++[>----<-]>.----.---.<+++++[>+++++<-]>-.<+++++++++[>---------<-]>-------.
@owenjones
owenjones / rand.c
Last active July 8, 2020 18:12
Simple random string generator
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <string.h>
void usage(char *file, int status) {
printf("Generates a string of random characters "
"(using numbers and upper/lowercase letters, unless otherwise specified).\n");
printf("usage: %s length [options]\n\n", file);
@owenjones
owenjones / Snapchat.py
Last active November 26, 2023 02:19
"Command line Snapchat" or "Why Snapchat needs to fix its private API".
#!/usr/bin/python3
import sys
import os
import json
from time import (time, sleep)
from hashlib import sha256
from zipfile import ZipFile
from io import (BytesIO, StringIO)
try :
@owenjones
owenjones / motd.sh
Created September 6, 2013 13:20
Generates a coloured "raspberry pi" header for use as the message of the day.
#!/bin/bash
echo -e "\033[0;32m
.~~. .~~.
'. \ ' ' / .'\033[0;31m
.~ .~~~..~. \033[0;37m _ _ \033[0;31m
: .~.'~'.~. : \033[0;37m ___ ___ ___ ___| |_ ___ ___ ___ _ _ ___|_|\033[0;31m
~ ( ) ( ) ~ \033[0;37m | _| .'|_ -| . | . | -_| _| _| | | | . | |\033[0;31m
( : '~'.~.'~' : ) \033[0;37m |_| |__,|___| _|___|___|_| |_| |_ | | _|_|\033[0;31m
~ .~ ( ) ~. ~ \033[0;37m |_| |___| |_| \033[0;31m
( : '~' : )