Skip to content

Instantly share code, notes, and snippets.

View saucecode's full-sized avatar

Julian saucecode

  • New Zealand
View GitHub Profile
var vapor = require('vapor');
var request = require('request');
var username = "[REDACTED]";
var password = "[REDACTED]";
var config = {
username: username,
password: password,
displayName: "[REDACTED]",
@saucecode
saucecode / postfix.py
Last active December 18, 2020 19:26
postfix calculator in python 2 & 3
# This has been moved to a repo -- https://github.com/saucecode/postfix-calculator
# all future updates found there
#!/usr/bin/env python
# postfix.py - a postfix calculator for python 2 & 3
# version 5 2016-09-20
import string, math
import inspect
private boolean canSee(float x, float y) {
float delta = 0.1f;
float targetDistance = (float) Math.hypot(x-this.x, y-this.y);
float angle = (float) (game.calcAngle(this.x, this.y, x, y) - Math.PI/2f);
float dx = (float) Math.sin(angle) * delta;
float dy = (float) -Math.cos(angle) * delta;
float mx = this.x, my = this.y;
for(float distance=0; distance < targetDistance; distance+=delta){
# fourthgrademaths.py
import random, time
def start(question_count):
rightAnswers = 0
wrongAnswers = 0
startTime = time.time()
for i in range(question_count):
qtype = random.randint(0,3)
if qtype == 0: # addition
@saucecode
saucecode / challenger_server.py
Created January 24, 2015 07:57
A proof of work challenge server that issues and checks POW challenges, keeping score
import socket, random, string, hashlib
'''
challenge request packet format
\x08[HASH] [START] [SEED]
sends a hash algorithm (SHA1, MD5, etc), what the hash must start with, and what the prehashed string must start with
challenge response packet format
\x09[FULL PRE-HASH]
The [FULL PRE-HASH] must start with [SEED] and when hashed with [HASH] algorithm, the result starts with [START]
sleep 0.2;
scrot -q 90 -s /home/saucecode/tmp/shot.jpg
SHOT=/home/saucecode/tmp/shot.jpg
OUTPUT=$(curl --silent -sf -F "files[]=@$SHOT" "http://pomf.se/upload.php" | grep -Eo '"url":"[A-Za-z0-9]+.*",' | sed 's/"url":"//;s/",//')
echo http://a.pomf.se/$OUTPUT | xclip -selection "clipboard"
mplayer /home/saucecode/tmp/confirm.wav