Skip to content

Instantly share code, notes, and snippets.

View fador's full-sized avatar

Marko Viitanen fador

View GitHub Profile
@fador
fador / Minecraft client block placement
Created November 13, 2010 13:00
1.2.2 client sends another block placement with illegal data
Packet 1
0f
Packet 2
00 03 ff ff fe ff 41 ff ff ff 17 05 12 00 00 00 01 01 0f 00 03 ff ff ff ff ff ff ff ff ff ff
Analysis
0f = block placement
00 03 = item id, dirt
ff ff fe ff = X coordinate, -257
@fador
fador / java-sha1.c
Created August 6, 2012 10:34
Java-like hex digest generation in C using openssl / libssl
/*
for mineserver ( https://github.com/fador/mineserver/ )
fador@iki.fi
*/
#include <stdio.h>
#include <string.h>
#include <openssl/sha.h>
int main()
{
@fador
fador / build.bat
Created August 8, 2012 13:02
Mineserver VC2010 autocompilation script
@echo off
set gitcmd="%ProgramFiles(x86)%\Git\bin\git.exe"
set sevenzipcmd="%ProgramFiles%\7-Zip\7z.exe"
rem goto onlybuild
del /S /Q mineserver
rd /S /Q mineserver
%gitcmd% clone git://github.com/fador/mineserver.git
:onlybuild
__constant sampler_t sampler =
CLK_NORMALIZED_COORDS_FALSE
| CLK_ADDRESS_CLAMP_TO_EDGE
| CLK_FILTER_NEAREST;
const int BLOCKSIZE = 16;
const int ME_RANGE = 32;
const int ME_RANGE_x2 = 64;
__kernel void motion_est(

Keybase proof

I hereby claim:

  • I am fador on github.
  • I am fador (https://keybase.io/fador) on keybase.
  • I have a public key whose fingerprint is 16B1 750F 041D 90FB 1999 6224 8B17 6992 57BB BE87

To claim this, I am signing this object:

@fador
fador / arc4_brute_search.cpp
Created November 3, 2016 16:43
arc4 hasher in OpenCL for tietoturvahaaste.fi challenge
/*
Copyright (c) 2016, Marko Viitanen (Fador)
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
@fador
fador / main.js
Last active April 27, 2017 07:38
Raspberry Pi -> ESP8266 request forward script in Node.js
// Use HTTP module
var http = require('http');
// Define a port we want to listen to
const PORT=8000;
// This function sends requests to the ESP8266
function doRequest(url) {
try {
var req = http.get({
@fador
fador / ffmpeg_libav_video_demux_decode_example.cpp
Created January 24, 2019 09:20
ffmpeg / libav demuxing and decoding example using the new API
#include <cstdlib>
#include <cstdio>
#include <cstring>
#ifdef HAVE_AV_CONFIG_H
#undef HAVE_AV_CONFIG_H
#endif
extern "C" {
#include "libavcodec/avcodec.h"
//var input = [3, 1, 88, 6, 2, 2];
var input = [Math.floor(Math.random()*100),Math.floor(Math.random()*100),Math.floor(Math.random()*100),Math.floor(Math.random()*100),Math.floor(Math.random()*100),Math.floor(Math.random()*100)];
var output = [0, 0, 0, 0, 0, 0];
var input_temp = [input[0], input[1], input[2], 255, input[3], input[4], input[5], 255];
// Improvised merge sort
// Sort list from lowest to highest.
@fador
fador / chat.js
Created December 14, 2019 20:14
90's chat server system in Node.js
var net = require('net');
var url = require('url');
// Client data
// connected socket
// if this is the chatwindow client -> send messages
var Client = function Client() {
this.socket = null;
this.chatWindow = false;
};