Skip to content

Instantly share code, notes, and snippets.

View pbsds's full-sized avatar

Peder Bergebakken Sundt pbsds

View GitHub Profile
@pbsds
pbsds / bgmmd5.py
Last active August 29, 2015 14:19
Computes a md5 hash from the bgm data of a flipnote
import PPM, sys, hashlib, warnings
warnings.filterwarnings("ignore")#disables the futurewarnings from numpy, bad practice!
if len(sys.argv) < 2:
print "error, no ppm filepath provided"
sys.exit(1)
flip = PPM.PPM().ReadFile(sys.argv[1], ReadFrames=False, ReadSound=True)
if not flip.SoundData[0]:
print "No BGM"
else:
print hashlib.md5(flip.SoundData[0]).hexdigest()
@pbsds
pbsds / nbf.py
Last active May 25, 2017 13:08
Converts hatena's .nbf files to .png and back
#written by pbsds
#quick and dirty, i may add this to UGO.py in Hatenatools
#
#This converter is licensed under AGPL3
#See http://www.gnu.org/licenses/agpl-3.0.html for more information
import sys, numpy as np, Image
def decode(input, output):
f = open(input, "rb").read()
len1 = np.fromstring(f[8:12], dtype=np.uint32)[0]
@pbsds
pbsds / Latency Simulator.py
Created September 18, 2014 21:04
This is something i made quick to get a feel of how a monitor with a certain input lag would feel like.
import pygame
pygame.init()
pygame.display.set_caption("Mouse Latency Simulator - by pbsds")
pygame.font.init()
window = pygame.display.set_mode((1280, 720))
font = pygame.font.Font(None, 20)
pygame.mouse.set_visible(False)
@pbsds
pbsds / MapGenerator.py
Created May 9, 2013 21:00
A simple random map generator using seeding and growth to produce it's landmasses.
import Image, random, math
#Made by pbsds/Peder Bergebakken Sundt
#Requires PIL to work
Palette = (0x0045A0,#0 - Dark water
0x0059BC,#1 - Water
0x0078F9,#2 - Shore water
0xFFF65E,#3 - Sand
0x2BE81F,#4 - Grass
0x26B719,#5 - Dark Grass