Skip to content

Instantly share code, notes, and snippets.

Avatar

Stefan Pataky troufster

View GitHub Profile
View lemon.js
var lb = require('lemonbar');
var i3 = require('i3').createClient();
var colors = {
bg_base : "#2871A1",
wactive : "#ffffff",
winactive :"#999999"
};
var glyphs = {
View gist:7426248
<!DOCTYPE html>
<html ng-app>
<head>
<title>wow spece</title>
<script src="http://davidbau.com/encode/seedrandom.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<script>
function SpaceCtrl($scope) {
$scope.particles = 0;
$scope.seed = 15;
View avr.js
//port of https://github.com/kiansheik/ard/tree/master/trunk/src/emulator
var debug = 1;
var Address = {
RAMEND : 0x02ff,
SPL : 0x5d, //(0x3D + 0x20)
SPH : 0x5e //(0x3E + 0x20)
};
View exceptionwrapper.cs
public static bool HasValue<T, TP>(T value, Expression<Func<T,TP>> property) {
try {
var memberExpression = (MemberExpression)property.Body;
var prop = (PropertyInfo)memberExpression.Member;
//Attempt to resolve
var val = prop.GetValue(value);
return val != null;
@troufster
troufster / formsdec.js
Created Apr 27, 2012
Decrypt .NET forms auth cookie in node.js
View formsdec.js
function hex2a(hex) {
var str = '';
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));
return str;
}
//Raw cookie
var cookie = "B417B464CA63FE780584563D2DA4709B03F6195189044C26A29770F3203881DD90B1428139088D945CF6807CA408F201DABBADD59CE1D740F853A894692273F1CA83EC3F26493744E3D25D720374E03393F71E21BE2D96B6110CB7AC12E44447FFBD810D3D57FBACA8DF5249EB503C3DFD255692409F084650EFED205388DD8C08BF7B941E1AC1B3B70B9A8E09118D756BEAFF25834E72357FD40E80E76458091224FAE8";
@troufster
troufster / ev.cs
Created Apr 26, 2012
Event driven architecture
View ev.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleApplication2
{
class Program
{
@troufster
troufster / cpu.js
Created Apr 3, 2012
generic cpu emulator :P
View cpu.js
//Mask with 16 bits
var bitMask = 0xFFFF;
var cmdAlias = {};
var errAlias = {
0x1 : 'Unknown instruction',
0x2 : 'Stack overflow'
}
View epijson.cs
//Work continued on Allan's blogpost from 2009
//http://labs.episerver.com/en/Blogs/Allan/Dates/2009/3/Output-PageData-as-JSON/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EPiServer.PlugIn;
using EPiServer.Core;
using System.Text;
@troufster
troufster / pwd.js
Created Oct 25, 2011
valtech problem 9 solution
View pwd.js
var crypto = require('crypto');
var vals = ["ab", "cd", "ef", "gh", "ij", "kl", "mn", "op", "qr", "st", "uv", "xy", "z0", "12", "34"];
var hex_md5 = function(data) {
return crypto.createHash('md5').update(data).digest("hex");
};
var try = function() {
View nodevore.js
var Nodevore = require('nodevore').Nodevore;
var n = new Nodevore({ username : 'user', password : 'pass'});
n.verifyAccount(function(err, data) {
console.log(data);
});
You can’t perform that action at this time.