Skip to content

Instantly share code, notes, and snippets.

View lukegb's full-sized avatar
🦦
👖

Luke Granger-Brown lukegb

🦦
👖
View GitHub Profile
@lukegb
lukegb / vvvvvv_music_unpacker.py
Created August 24, 2011 21:15
Unpack music from VVVVVV's music file!
f = open("vvvvvvmusic.vvv", 'rb')
q = f.read()
FILE_NAMES = ['0levelcomplete.ogg','1pushingonwards.ogg','2positiveforce.ogg','3potentialforanything.ogg','4passionforexploring.ogg','5intermission.ogg','6presentingvvvvvv.ogg','7gamecomplete.ogg','8predestinedfate.ogg','9positiveforcereversed.ogg','10popularpotpourri.ogg','11pipedream.ogg','12pressurecooker.ogg','13pacedenergy.ogg','14piercingthesky.ogg']
startAt = endAt = -1
musStartAt = musEndAt = -1
currentMus = 0
while True:
oldStartAt = startAt
@lukegb
lukegb / howmuch.html
Last active May 15, 2021 18:05
shiptoasting
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.total-money {
font-weight: bold;
}
.container td {
padding: 0.2rem 0.5rem;
}
.slider {
#!/bin/bash
set -e
pushd /tmp/src
if [[ `go list -f {{.Incomplete}}` == "true" || ! -z "$IMPORT_URL" ]]; then
INSTALL_URL=${INSTALL_URL:-$IMPORT_URL}
if [[ ! -z "$IMPORT_URL" ]]; then
popd
echo "Assembling GOPATH"
export GOPATH=`realpath $HOME/go`
mkdir -p "$GOPATH/src/$IMPORT_URL"
From 096a484096decc41122e312d52a4fd615266fe43 Mon Sep 17 00:00:00 2001
From: Luke Granger-Brown <git@lukegb.com>
Date: Sun, 26 Jul 2020 00:44:44 +0100
Subject: [PATCH 7/7] Fix gr-hovercard-behavior under Firefox.
Firefox doesn't implement toElement/fromElement (they're not in the spec,
and were implemented by Chrome apparently for compatibility with IE), but
does implement target and relatedTarget, which are part of the UI Events
spec (https://w3c.github.io/uievents/#interface-mouseevent).
<?php
$dir = 'news';
$nstuffa = scandir($dir);
$nstuff = array();
foreach ($nstuffa as $nitem) {
if ($nitem == '.' || $nitem == '..') continue;
$nstuff[$nitem] = filectime($dir.'/'.$nitem);
}
arsort($nstuff, SORT_NUMERIC);
$ncount = 0;
@lukegb
lukegb / hhhhhhhhhhhhh
Created July 15, 2012 17:47 — forked from anonymous/hhhhhhhhhhhhh
hhhhhhhhhh
elif enamyAttack == 3:
time.sleep(1)
print('The ' +enamyDetails[0] + ' attacks you with ' + enamyDetails[6] + ' for ' + enamyDetails[7] +' damage')
playerHealth = playerHealth - int(enamyDetails[7])
if playerHealth <= 0:
combotLost = True
elif enamyDetails[10] !=0:
playerStatus = int(enamyDetails[10])
playerTurn = 0
@lukegb
lukegb / dukpy.py
Created January 13, 2016 04:19
I went a little overboard
import django
django.setup()
from dukpy import Context
from ore.projects.models import Project
ctx = Context()
ctx.define_global_obj("Project", Project)
ctx.define_global_func("get_first_project_for_namespace", lambda name: Project.objects.filter(namespace__name=name).first())
@lukegb
lukegb / asasasas.py
Created July 17, 2012 18:48 — forked from anonymous/asasasas.py
pypyppypypypy
class Point:
''' Point class for representing and manipulating x,y coordinates. '''
def __init__(self, initX, initY):
'''Create a new point at the origin'''
self.x = initX
self.y = initY
p = Point(7, 6)
q = Point(8, 2)
import socket
MUTED_GROUP = 8
UNMUTED_GROUP = 7
WHO_UID = 'uaec6gN9PL9qwP5y1NGGW3D95VA='
#WHO_UID = 'BaP5bZRXx7OP59qJojvvHHxvx0w='
HOST = '127.0.0.1'
PORT = 25639
def wait_for_ok(s):
@lukegb
lukegb / react.py
Created January 15, 2016 16:47
Calling React from Python? Certainly!
import dukpy
ctx = dukpy.RequirableContext(['/homes/leg13/test/node_modules'])
ret = ctx.evaljs("""
var React = require('react');
var HelloWorld = React.createClass({
render: function() {
return React.createElement('p', null, 'Hi!');
}