Skip to content

Instantly share code, notes, and snippets.

View robert-nix's full-sized avatar

Robert Nix robert-nix

View GitHub Profile
@robert-nix
robert-nix / dump.cpp
Last active April 21, 2016 21:44
SC2 ids dumper (23260, 24247 offset; 1.5+ only) + ASLR support
/* Dump type ids for Units and Abils. SC2.
*
* Keep it simple: cl dump.cpp Version.lib
* May need to enable LAA if 32 bit.
*/
#include <Windows.h>
#include <psapi.h>
#include <TlHelp32.h>
#include <stdint.h>
@robert-nix
robert-nix / GenericSort.c
Created March 29, 2013 04:13
V8 Array::sort; -m64 -std=c99 Playing around 100000 length list: ~7ms with -O3, ~16ms without, and about 7 seconds in javascript
int GenericSort(void **list, size_t length, compareFn compare) {
// Compare the list as ptrdiff_t's if no comparator is specified.
if (!compare) {
int basic_compare(void *a, void *b) {
int result = 0;
// Compare as signed
ptrdiff_t aL = (ptrdiff_t)a;
ptrdiff_t bL = (ptrdiff_t)b;
if (aL < bL) {
@robert-nix
robert-nix / twitchlogger.go
Created May 15, 2013 07:29
My first Golang program; an absolute mess.
package main
import (
"crypto/tls"
"encoding/json"
"flag"
"fmt"
irc "github.com/fluffle/goirc/client"
"labix.org/v2/mgo"
"net/http"
@robert-nix
robert-nix / Our.cs
Last active September 27, 2016 16:51
Hack tool to rewrite Hearthstone's Unity3d asset files with a custom assembly/monobehaviour
using System;
using System.IO;
using System.Threading;
using UnityEngine;
public class OurMono : MonoBehaviour
{
StreamWriter log;
Timer t;
@robert-nix
robert-nix / plot.py
Last active December 22, 2015 20:19
IPython GGtracker Hello, world! plot (hackiness warning)
%pylab inline
import urllib2
import json
json_api_test = urllib2.urlopen("http://api.ggtracker.com/api/v1/matches?game_type=1v1&map_name=Derelict%20Watcher%20TE&race=terran&replay=true&vs_race=zerg&paginate=true&average_league=4&limit=100").read()
json_api_result = json.loads(json_api_test)
json_api_results = json_api_result['collection']
json_result_ids = [res['id'] for res in json_api_results]
scoreBin = (items) ->
failure = 0
color = {}
type = {}
pattern = {}
for item in items
color[item.color] or= 0
type[item.type] or= 0
pattern[item.pattern] or= 0
color[item.color]++
do ->
sm2 = undefined
Object.defineProperty window, 'soundManager',
get: -> sm2
set: (val) ->
sm2 = val
if sm2?
bDI = sm2.beginDelayedInit
sm2.beginDelayedInit = ->
sm2.preferFlash = false
require('GlobalStrings')
-- generated from s_bonusStatStringTags
local bonusStats = {
[0] = "ITEM_MOD_MANA_SHORT",
[1] = "ITEM_MOD_HEALTH_SHORT",
[3] = "ITEM_MOD_AGILITY_SHORT",
[4] = "ITEM_MOD_STRENGTH_SHORT",
[5] = "ITEM_MOD_INTELLECT_SHORT",
[6] = "ITEM_MOD_SPIRIT_SHORT",
@robert-nix
robert-nix / enchantItemSpellids.json
Last active August 29, 2015 14:05
select effectItemType as itemID, effectMiscValue_0 as enchantID, spellID from SpellEffect where effect == 53 and effectItemType != 0
{
"enchantItems": [
{
"enchantID": "4720",
"itemID": "38679",
"spellID": "7418"
},
{
"enchantID": "41",
"itemID": "38766",
@robert-nix
robert-nix / DungeonJournalItems.json
Last active August 29, 2015 14:05
select itemID, JournalEncounterItem.difficultyMask, JournalEncounterItem.factionMask, JournalEncounter.name_lang as encounterName, JournalInstance.name_lang as instanceName from JournalEncounterItem inner join JournalEncounter on journalEncounterID == JournalEncounter.ID left outer join JournalInstance on journalInstanceID == JournalInstance.ID
This file has been truncated, but you can view the full file.
[
{
"itemID": 2169,
"difficultyMask": 1,
"factionMask": 4294967295,
"encounterName": "Glubtok",
"instanceName": "Deadmines"
},
{
"itemID": 5195,