Skip to content

Instantly share code, notes, and snippets.

@alexnask
alexnask / Protocol.md
Created June 30, 2014 17:13
Basic protocol description

Terms used

Tracker: a computer in the network that keeps track of other computers in it and can issue commands altering interactions between them. Client: any computer in the network that is not the tracker. Leecher: a client that does not rebroadcast replay information to others. Node: a client that is not a leecher.

Library functionality

@alexnask
alexnask / test_access.c
Last active August 29, 2015 14:03
SC2 replay memory read while game is running
#include <windows.h>
#include <tlhelp32.h>
#include <Psapi.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
const int MAX_PROC_NAME_SIZE = 64;
const int MAX_PROC_LIST_SIZE = 256;
@alexnask
alexnask / macro-test.ooc
Last active August 29, 2015 14:06
Macro ideas
// Rust like system, let's make a simple example macro definition and call
raise-if-null: macro($expr, $msg: Expression) {
if($expr == null) raise($msg)
}
// Call
#raise-if-null(null, "Good!")
// Macros can be expressions or statements
@alexnask
alexnask / publish_packages.sh
Created September 20, 2014 19:57
My little cross-compiling + packaging script for rock (generates builds.ooc-lang.or/packages)
#!/bin/sh
# This script cross-compiles rock for multiple architecures and systems, makes a package for each of them and publishes on builds.ooc-lang.org
# Vendor prefixes should be
# rock/vendor-prefix -> linux64
# rock/win32-vendor-prefix -> win32
# rock/X-vendor-prefix -> X
# $1: architecture to compile to
function compile {
@alexnask
alexnask / awesome.lsp
Created August 16, 2015 19:28
AutoLisp script used to complete table info of some specific cross sections based on lines as intelligently as possible
(defun getAllTexts ()
(setq selection (ssget "_X" '((0 . "TEXT,MTEXT")))
textlist (list))
(if selection
(repeat (setq i (sslength selection))
(setq e (ssname selection (setq i (1- i)))
x (cdr (assoc 0 (entget e)))
)
@alexnask
alexnask / admin.html
Created November 15, 2010 20:58
admin.thtml
{[ _GET(name) == _CONFIG(adminName) ]
{[ _GET(password) == _CONFIG(adminPass) ]
<!-- Logged in as administrator -->
{[ _POST(action) == NULL ]
<!-- No action :) -->
{[ _GET(database) == NULL ]
<!-- And no database selected -->
<h1>Listing databases</h1><br/>
<%
@alexnask
alexnask / gist:705107
Created November 18, 2010 15:19
Windows rock compilation error log
Creating bin/ in case it does not exist.
mkdir -p bin/
Compiling from C source
cd build/ && ROCK_DIST=.. make
make[1]: Entering directory `c:/Documents and Settings/alex_/Desktop/rock/build'
Finished compiling for arch 32
gcc -I c-source -I ../libs/headers/ -g -std=gnu99 -Wall -D__OOC_USE_GC__ -DGC_NO_THREAD_REDIRECTS -w -DROCK_BUILD_DATE="\"bootstrapped\"" -DROCK_BUILD_TIME="\"\"" c-source/source/rock/rock.o c-source/sdk/lang/IO.o c-source/sdk/lang/types.o c-source/sdk/lang/Iterators.o c-source/sdk/lang/String.o c-source/sdk/lang/Exception.o c-source/sdk/lang/System.o c-source/sdk/lang/BufferIterator.o c-source/sdk/lang/Abstractions.o c-source/sdk/lang/Character.o c-source/sdk/lang/Format.o c-source/sdk/lang/Buffer.o c-source/sdk/lang/VarArgs.o c-source/sdk/lang/Numbers.o c-source/sdk/lang/Memory.o c-source/sdk/structs/ArrayList.o c-source/sdk/structs/List.o c-source/sdk/math/Random.o c-source/sdk/os/Time.o c-source/sdk/native/win32/types.o c-source/sdk/structs/HashMap.o c-source/sdk/threading/Thread.o c-sou
@alexnask
alexnask / gist:727463
Created December 3, 2010 19:54
Include and execute another file's code in thtml :)
<html>
<p>Hey im html!</p>
<%
ReadFile: data, "someFile.thtml"
Execute: data
%>
<p>Oh, im ended ;(</p>
</html>
@alexnask
alexnask / fileA.html
Created December 3, 2010 20:05
File 'includes' and variable declarations in ooc
<%
Set: a,"a"
ReadFile: data,"fileB.thtml"
Execute: data
Show: b
%>
@alexnask
alexnask / gist:728274
Created December 4, 2010 15:54
thtml sample
<%
Database: "news"
DescOrder: "id"
Column: Title,"title"
Column: Contents,"contents"
LineCount: NewsCount
for[i:0..5]{
if[Title(i) != NULL]{
%>