Skip to content

Instantly share code, notes, and snippets.

@seece
seece / uninstall_programs.ps1
Created September 6, 2013 10:44
Uninstalls the Windows applications that match the words defined by user.
<#
.SYNOPSIS
Uninstalls all unwanted programs listed in the $programNames array.
#>
function Test-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
@seece
seece / puhuja.py
Created October 8, 2013 12:47
Lukee RSS-syötteen suomeksi.
import feedparser
import argparse
import subprocess
from time import mktime
from datetime import datetime
def get_last_edited():
f = open('last_modified.temp', 'r')
data = f.read()
f.close()
@seece
seece / convert.sh
Created December 19, 2013 10:44
Converts bunch of transparent pngs to a gif animation.
# make sure you have imagemagick installed
convert -coalesce -delay 20 -loop 0 sprite*.png -background white -alpha remove anim.gif
@seece
seece / rename_tiles.sh
Created January 26, 2014 13:35
Some scripts for Doom sprite manipulation. They may or may not work correctly, only tested with Cygwin+Imagemagick
# renames tiles given in dir $1 as frames given as list file $2
tilelist=$(ls $1)
framelist=$(cat $2)
tiles=($tilelist)
frames=($framelist)
count=${#frames[@]}
for i in `seq 1 $count`
do
@seece
seece / ttrack.py
Created May 10, 2016 20:42
A "timetracker" "application"
import readline
import datetime
logpath = "times.txt"
lines = []
try:
with open(logpath, "r") as f:
lines = f.readlines()
except:
@seece
seece / ebin
Created June 3, 2016 15:20
A terrible binary number printer
#!/usr/bin/python
import sys
from ast import literal_eval
if len(sys.argv) != 2:
print "Usage: ebin INTEGER"
sys.exit(1)
s = "{0:08b}".format(literal_eval(sys.argv[1]))
n = 4 # split into 4 bit blocks
# awful reversing hack to get proper formatting
s = s[::-1]
@seece
seece / tweak_values.inc
Created March 18, 2018 14:37
C++ tweak variable example.
// This file is automatically generated, but you can add your own variables here too.
// Syntax: SET_VAR(variable_name, default, low_limit, upper_limit, slider_exponent)
// In code you can read the variable with: GET_VAR(variable_name)
SET_VAR(tower_height, 520.0f, 0.0f, 3000.0f, 1.0f)
SET_VAR(KSpring, 520.0f, 1.0f, 3000.0f, 1.0f)
SET_VAR(WireRadius, 2.0f, 0.1f, 34.0f, 1.0f)
SET_VAR(volcanic_sun_x, 0.088000, -20.0f, 20.0f, 1.0f)
SET_VAR(mothership_sun_x, 2.026000, -5.0f, 5.0f, 1.0f)
SET_VAR(mothership_sun_y, 0.507000, -5.0f, 5.0f, 1.0f)
SET_VAR(wire_fog_exp, 0.0f, 0.0f, 100.0f, 1.0f)
@seece
seece / jasc_convert.py
Created February 15, 2014 13:08
Converts JASC palette files to raw bytes.
#!/usr/bin/env python
import argparse
from struct import *
import re
def write_raw_palette(palette, output_path, write_header):
data = ""
header = pack('I', len(palette))
@seece
seece / fpaq0.py
Last active April 19, 2020 18:39
An arithmetic coder
"""
A pretty terrible arithmetic coder with a 0th order model.
Based on Matt Mahoney's fpaq0 implementation available at
http://mattmahoney.net/dc/#fpaq0
"""
import sys
@seece
seece / nes_controller.pde
Created January 13, 2016 13:42
How to read NES controller button presses with an Arduino
/* This code is released into the public domain.
* Pekka Väänänen, 2016 */
/*
http://www.mit.edu/~tarvizo/nes-controller.html
+----> Power +5V (white)
|
5 +---------+ 7
| x x o \