Skip to content

Instantly share code, notes, and snippets.

#if _WIN32_WINNT < 0x0500
# error "should be NT"
#endif
#include <windows.h>
#include <tlhelp32.h>
#include <winternl.h>
#include <stdio.h>
DWORD getppid()
{
@jedi4ever
jedi4ever / pom.xml
Created April 13, 2011 08:30
using fat-32 lib: create a new floppy img from all files in a directory (non recursive)
package be.jedi.dir2floppy;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import de.waldheinz.fs.FileSystem;
import de.waldheinz.fs.FsDirectoryEntry;
public class Stopwatch {
public static void main(String[] args){
long startingTime = System.currentTimeMillis();
long currentTime;
long deltaTime = 0;
long stopTime = 60 * 1000; // 60 seconds in miliseconds
while((currentTime = System.currentTimeMillis()) <= startingTime + stopTime){
deltaTime = currentTime - startingTime;
System.out.printf("%d miliseconds passed\n", deltaTime);
}
@brettle
brettle / 3ds-to-dlna-vob.sh
Created January 20, 2012 23:35
Shell script to convert a Nintendo 3DS AVI file to an over-under DLNA-compliant NTSC MPEG-2 program stream (VOB) for viewing on some 3D TVs
#!/bin/sh
# Copyright (c) 2012 by Dean Brettle
# Licensed under the GPLv3.
# To use:
# chmod +x 3ds-to-dlna-vob.sh
# 3ds-to-dlna-vob.sh yourfile.avi
# The horizontal offset between the left and right videos of an object that
# should appear on the surface of the screen when viewed in 3D.
delta=70
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.yifanlu.sshtunnel</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/ssh</string>
<string>-T</string>
<string>-D</string>
@yifanlu
yifanlu / TetrisGame.java
Created May 13, 2012 05:43
Java programming guide by example
/*
This purpose of this Tetris demo is to demostrate three things:
1) Structure of a game
We have a game loop, a clock, an update method, and a draw method
*) The clock calculates the number of seconds since the last loop.
This allows us to move the game at a constant pace even if the CPU fluctuates.
*) The update method does the logic of the game, including collision checks, random character generation, etc.
The update method delegates the task, so each object is responsible for updating itself
*) The draw method does the rendering of stuff to screen, and just like the update method, each object draws itself
@yifanlu
yifanlu / pathtest.c
Created August 6, 2012 21:57
Vita possible exploit testing
//
// main.c
//
// Created by Yifan Lu on 8/6/12.
//
#define G_DIR_SEPARATOR '/'
// I don't know if __native_client__ is defined on the Vita or not, so
// you can try it both ways.
#define __native_client__
@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@syl20bnr
syl20bnr / robocop.bat
Created December 12, 2012 16:23
robocopy exit codes suck :-)
rem -------------------------------------------------------------------------------
rem this file controls the error level returned by the tool robocopy in order to
rem be usable in a custom build step of Visual Studio
rem -------------------------------------------------------------------------------
robocopy.exe /A-:R /NP /NJH /NJS /NDL /NFL /NS /NC %*
rem if errorlevel 16 echo Robocopy Exit Status: ***FATAL ERROR*** & exit /b 1
rem if errorlevel 15 echo Robocopy Exit Status: FAIL MISM XTRA COPY & exit /b 1
rem if errorlevel 14 echo Robocopy Exit Status: FAIL MISM XTRA & exit /b 1
@kozy4324
kozy4324 / ua.md
Last active June 15, 2016 10:57
User Agent
type Regexp
iPhone .iPhone.
iPad .iPad.
Android .Android.
Windows Phone .Windows Phone.
BlackBerry .BlackBerry.
Symbian .Symbian.
IE .Mozilla/[\d.]+ (compatible; MSIE (\d+).
Chrome .Chrome.(\d+).