Skip to content

Instantly share code, notes, and snippets.

Avatar

zhuowei

View GitHub Profile
@zhuowei
zhuowei / ping.log
Last active August 29, 2015 13:56
A preview of what I'm working on
View ping.log
[zhuowei@jem ~]$ ping -s 255 -i 0.2 localhost
PING localhost (127.0.0.1) 255(283) bytes of data.
86 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 (truncated)
109 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 (truncated)
126 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 (truncated)
109 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 (truncated)
122 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 (truncated)
40 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 (truncated)
111 bytes from localhost (127.0.0.1): icmp_seq=7 ttl=64 (truncated)
119 bytes from localhost (127.0.0.1): icmp_seq=8 ttl=64 (truncated)
@zhuowei
zhuowei / modpescript_dump.txt
Created February 8, 2014 00:14
All ModPE script methods in BlockLauncher 1.6.6
View modpescript_dump.txt
addItemInventory(par1int, par2int, par3int);
bl_setMobSkin(par1int, par2String);
bl_spawnMob(par1double, par2double, par3double, par4int, par5String);
clientMessage(par1String);
explode(par1double, par2double, par3double, par4double);
getCarriedItem();
getLevel();
getPitch(par1Object);
getPlayerEnt();
getPlayerX();
@zhuowei
zhuowei / addtwo.c
Created February 10, 2014 16:58
Self modifying code demo
View addtwo.c
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
int AddTwo(int input) {
return input + 2;
}
void patchThisShizzle() {
int pageSize = sysconf(_SC_PAGE_SIZE); //size of a page. Smallest unit that
@zhuowei
zhuowei / c0deh4cker.bf
Last active August 29, 2015 13:56
Decompiler-ish thing for @kmcallister's RIP https://github.com/kmcallister/rip and decompiled output of @C0deH4cker's Brainf?ck source
View c0deh4cker.bf
>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++++++++++++++++++++++++.-------.----.++++++++++++++++++.--------------.---------------------------------------------------------------------.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+++++++++.++++++.---------------.+++++++++++++.----------------------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.------------.---.---------------------------------------------------------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.++++++.-----------.++++++.-----------------------------------------------------------------------.++++++++.+++++++++++.-.------------------.++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.---.+++++++++++++++++++.----------------------------------------------------------------------------------------.++++++++++++++++++++++++
@zhuowei
zhuowei / hexablewords.txt
Created February 27, 2014 19:28
A list of 8-letter words that can be spelled with hexspeak.
View hexablewords.txt
Abbad1de
Abe11cea
acc01ade
acc011ed
acc011ee
ac1d1f1c
Adabe11e
Ade1a1da
Ade1a1de
Aeac1dae
@zhuowei
zhuowei / oy.txt
Last active August 29, 2015 13:57
Words that end in -ffle
View oy.txt
Carboloy
Coy
Eloy
Elroy
Fauntleroy
Fitzroy
Joy
Kilroy
Leroy
McCoy
@zhuowei
zhuowei / irratate.markdown
Last active August 29, 2015 13:57
Haiku irratations
View irratate.markdown

Simple things that annoy me in Haiku and that I should try to fix

[ ] When text is selected in Pe, bringing up the Find dialog doesn't copy in the text

[ ] When I try to use the find dialog, the highlighted search result is faint unless I switch back to the main editor window

[ ] Pe doesn't show if a file has been modified since one saved last

[ ] WebPositive sends out a really weird User-Agent that results in every site serving the dumbphone versions of their sites (and no way to switch user agents)

@zhuowei
zhuowei / hashtable.h
Last active August 29, 2015 13:57
HashTable header, copied in
View hashtable.h
typedef struct HashTableObjectTag HashTableObject;
typedef HashTableObject *HashTablePTR;
typedef struct HashTableInfoTag
{
unsigned int bucketCount; // current number of buckets
float loadFactor; // ( number of entries / number of buckets )
float useFactor; // ( number of buckets with one or more entries / number of buckets )
unsigned int largestBucketSize; // number of entries in the bucket containing the most entries
int dynamicBehaviour; // whether or not the Hash Table will resize dynamically
float expandUseFactor; // the value of useFactor that will trigger an expansion of the number of buckets
View twopower.js
(function(){
var gridElem = document.getElementsByClassName("grid-cell")
function FakeInputManager(){}
function FakeScoreManager(){}
function FakeActuator(){}
FakeInputManager.prototype = {"on": function(){}};
FakeScoreManager.prototype = {"get": function(){return 0}, "set": function(){}};
@zhuowei
zhuowei / pidforce.c
Created March 19, 2014 22:47
Use brute force and ignorance to run a program with a specified PID
View pidforce.c
#include <unistd.h>
#include <stdlib.h>
int main(int argc, char** argv) {
int targetPid = atoi(argv[1]);
for(;;) {
int newPid = fork();
if (newPid == 0) { //child
newPid = getpid();
if (newPid == targetPid) {
execv(argv[2], argv + 3);