Skip to content

Instantly share code, notes, and snippets.

@Mortal
Mortal / gist:791193
Created January 22, 2011 15:54
Minecraft server behind firewall
camel15:rav:~/workspace/mc% java -cp minecraft-server.jar com.mojang.minecraft.server.MinecraftServer
! 16:50:11 ######################### WARNING #########################
! 16:50:11 verify-names is set to false! This means that anyone who
! 16:50:11 connects to this server can choose any username he or she
! 16:50:11 wants! This includes impersonating an OP!
! 16:50:11 If you wish to fix this, edit server.properties, and change
! 16:50:11 verify-names to true.
! 16:50:11 ###########################################################
16:50:11 Setting up
16:50:11 Loading level
@Mortal
Mortal / hypem-download.user.js
Created August 11, 2011 14:21
Download music from Hype Machine
var cs = soundManager.createSound;
soundManager.createSound = function () {
var r = cs.apply(this, arguments);
document.getElementById("player-links").innerHTML =
'<a href="'+r.url+'" download style="color: white; font-size: 12px; font-weight: bold">Download</a>';
return r;
}
@Mortal
Mortal / buildlog1
Created December 20, 2011 17:29
TPIE build troubles
Scanning dependencies of target tpie
[ 1%] Building CXX object tpie/CMakeFiles/tpie.dir/key.cpp.o
[ 2%] Building CXX object tpie/CMakeFiles/tpie.dir/backtrace.cpp.o
[ 4%] Building CXX object tpie/CMakeFiles/tpie.dir/cpu_timer.cpp.o
[ 5%] Building CXX object tpie/CMakeFiles/tpie.dir/file_count.cpp.o
[ 7%] Building CXX object tpie/CMakeFiles/tpie.dir/execution_time_predictor.cpp.o
[ 8%] Building CXX object tpie/CMakeFiles/tpie.dir/fractional_progress.cpp.o
[ 10%] Building CXX object tpie/CMakeFiles/tpie.dir/job.cpp.o
[ 11%] Building CXX object tpie/CMakeFiles/tpie.dir/logstream.cpp.o
[ 13%] Building CXX object tpie/CMakeFiles/tpie.dir/memory.cpp.o
@Mortal
Mortal / gist:1521056
Created December 26, 2011 12:20
CSS legend
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Legend</title>
<style type="text/css">
ul, li {
margin: 0; padding: 0; list-style-type: none;
}
li:before {
@Mortal
Mortal / sloccount
Created January 23, 2012 17:48
Simple sloccount
#!/bin/sh
find $* -name '*.h' -or -name '*.cpp' -or -name '*.inl' |xargs cat | sed -e 's/\/\/.*//; s/^[ \t]*//' | grep . | wc
@Mortal
Mortal / out
Created February 16, 2012 19:46
Solution
After 27291131911 attempts.
The badness is:
1026
The result is:
0 -> 14: 3 4
1 -> 13:
2 -> 20: 2
3 -> 20: 2
4 -> 14: 0 4
5 -> 14: 0 4
@Mortal
Mortal / sort.log
Created March 7, 2012 12:32
sort_speed_test format
rav@sanford:~/work/tpie/build$ test/speed_regression/sort_speed_test 5 100
-------------------------------------------------------------------------------
Sort speed test
Hostname: sanford
Platform: Linux 64-bit
Git branch: refs/heads/master
Git commit: 0646604f8133862dd47d4928fcb7466aefddecba
Local time: 2012-Mar-07 13:33:00
Block size: 2048 KiB
@Mortal
Mortal / awesome.md
Created March 12, 2012 13:57
Pipelining awesomeness

This:

static void do_pipeline(int factor, int term) {
	pipeline p = scanf_ints() | linear(factor, term) | printf_ints();
	// Defined to mean:
	// Read integers using scanf,
	// apply the function f(n) = factor*n + term,
	// print using printf.
	p();
@Mortal
Mortal / gist:2023156
Created March 12, 2012 16:25
Tournament tree

In a streaming context, we want to always be able to report the k least elements seen so far.

We test four different solutions of this problem:

  • Max-tournament tree (k compile-time constant) in which the winner is repeatedly replaced with the new element

  • Static STL max-heap (k compile-time constant) in which std::push_heap and std::pop_heap are used

  • Dynamic STL max-heap, using the GNU std::priority_queue implementation

@Mortal
Mortal / gist:2028012
Created March 13, 2012 10:21
Git CMake module
rav@sanford:~/work/tpie/build$ git commit -m 'Move sysinfo.h/cpp into tpie/'
[master 5f0bebb] Move sysinfo.h/cpp into tpie/
5 files changed, 6 insertions(+), 3 deletions(-)
rename {test/speed_regression => tpie}/sysinfo.cpp.in (100%)
rename {test/speed_regression => tpie}/sysinfo.h (100%)
rav@sanford:~/work/tpie/build$ make
-- TBB_INSTALL_DIR not found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/rav/work/tpie/build