Skip to content

Instantly share code, notes, and snippets.

View OmaMuistavaSanakirja.java
package sanakirja;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Scanner;
@seece
seece / gist:3099276
Created Jul 12, 2012
Sending an entity from SSQC to CSQC
View gist:3099276
< cce> is there any documentation on how to send an entity from the server to the csqc?
< cce> i can send it but couldn't figure out how to recieve it on the client side
<@LordHavoc> I'm not sure if there is actual documentation :P
<@LordHavoc> there is a lot of sample code
<@LordHavoc> SendEntity basically begins with a WriteByte to MSG_ENTITY containing an entity type
<@LordHavoc> the types are your own constants
<@LordHavoc> CSQC_Ent_Update is called on the csqc and the first thing it must do is ReadByte() to get that entity type, then
a switch or if else to figure out which one it is
<@LordHavoc> once it has figured out what entity type it is, it must issue Read calls similar to the Write calls that the
SendEntity function wrote
View gist:3278951
some words on mario paint formats
written by cce
thanks to strobe for some guidance
Save a savestate with ZSNES version V143. V151 should work too, and probably other versions.
The song data begins from offset 0x15F7 (or is it 0x15F7?) and its length is 576 bytes.
Song speed is stored at offset 0x183B
@seece
seece / mikroblog.bat
Last active Dec 18, 2015
This batch script creates an RSS 2.0 XML-file called posts.xml in the current directory, and prompts the user for a message. The message is added to the XML file as a news-feed item. When placed in a Dropbox public folder it can act as a minimal blogging platform, since the feed file can be read with a standard RSS reader application.
View mikroblog.bat
@echo OFF
setlocal EnableDelayedExpansion
set "xml_template=^^<?xml version="1.0" encoding="windows-1252"?^^>^^<rss version="2.0"^^>^^<channel^^>^^<title^^>microblog title^^</title^^>^^<description^^>My mikroblog of excellence!^^</description^^>^^</channel^^>^^</rss^^>"
set post_file=posts.xml
if exist %post_file% (
echo Post database %post_file% found.
) else (
@seece
seece / uninstall_programs.ps1
Created Sep 6, 2013
Uninstalls the Windows applications that match the words defined by user.
View uninstall_programs.ps1
<#
.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 Oct 8, 2013
Lukee RSS-syötteen suomeksi.
View puhuja.py
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 Dec 19, 2013
Converts bunch of transparent pngs to a gif animation.
View convert.sh
# 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 Jan 26, 2014
Some scripts for Doom sprite manipulation. They may or may not work correctly, only tested with Cygwin+Imagemagick
View rename_tiles.sh
# 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 / audio.c
Last active Aug 29, 2015
Tracker module playback using PortAudio and DUMB.
View audio.c
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <stdbool.h>
#include <portaudio.h>
#include "dumb.h"
#include "audio.h"
#define BUFFERSIZE (2048L)
#define SAMPLE_RATE (44100)
@seece
seece / jasc_convert.py
Created Feb 15, 2014
Converts JASC palette files to raw bytes.
View jasc_convert.py
#!/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))