Skip to content

Instantly share code, notes, and snippets.

View whizzter's full-sized avatar

Jonas Lund whizzter

View GitHub Profile
@whizzter
whizzter / EsprimaSourceMapTransformer.cs
Created June 27, 2021 00:37
Esprima.NET SourceMap adjustment
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Esprima;
using Esprima.Ast;
// 2clause BSD licence applies.
namespace EsprimaSourceMap
@whizzter
whizzter / proprot.js
Created January 2, 2019 02:58
JavaScript property value rotation microbenchmark
// node.js is about 4-5x faster than JS->C compiler and 470x faster than duktape
var obj1,obj2;
obj1={x:12,y:34};
obj2={x:56,y:78};
var start,stop;
console.log("Warmup");
rot(obj1,obj2);
console.log("Bench");
start=new Date().valueOf();
@whizzter
whizzter / build.bat
Last active December 20, 2017 23:17
Comparing performance of polymorphic member accessors to plain struct accessing
cl /Ox /O2 /EHsc /Fetpp.exe /DPLAINPROP t.cpp
cl /Ox /O2 /EHsc /Fetvirt.exe /DVIRT t.cpp
cl /Ox /O2 /EHsc /Fetvoff.exe /DVOFF t.cpp
@whizzter
whizzter / notes.txt
Created November 18, 2017 09:45
cling building on windows nov2017
With visual studio 2015 begin with upgrading to update3 since there's warnings about lower versions in the build scripts.
Also make sure python is in the path (tried with python2)
Building win32 won't work, neither CL toolset nor final binary will work. Stick to x64
Start with ahmidous comment https://github.com/root-project/cling/issues/186#issuecomment-341898792
git clone http://root.cern.ch/git/llvm.git src
cd src
git checkout cling-patches
@whizzter
whizzter / MissileMain.java
Created June 20, 2017 12:14
Small Missile Command Clone
package missilecommand_java;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@whizzter
whizzter / mymod.js
Last active June 6, 2017 07:38
automatically exporting a module with koa (possibly insecure)
exports.bah=function(count,name){
let out="";
while(count--)
out+=name+" ";
return out;
};
@whizzter
whizzter / cotmta.cpp
Created March 13, 2017 23:58 — forked from paniq/cotmta.cpp
Cheney on the MTA in C++11
// Syntax demo for writing Cheney on the MTA style code in C++11
// (see http://home.pipeline.com/~hbaker1/CheneyMTA.html for more info)
//
// Using variadic macros, I managed to design a syntax that is good enough
// to write in, as opposed to the automated code generation that COTMTA
// originally envisioned.
//
// key reasons why I intend to use this:
// * Writing a Scheme interpreter that keeps the C stack compact
@whizzter
whizzter / varlet_es6.js
Last active January 26, 2016 09:19
Var and let
<!-- find the bug -->
<html>
<head>
<script>
"use strict";
function iny() {
let body=document.getElementById("bod");
let nums=[1,2,3];
@whizzter
whizzter / gist:ad926ffd2beadac364a2
Created November 23, 2015 22:14
AuthzSVNAccessFile , user1 being main owner, user2 and user3 are users with specific permissions
[groups]
grp1=user2
[/]
user1=rw
@grp1=
user3=
[/some/path]
user3=rw