Skip to content

Instantly share code, notes, and snippets.

View praseodym's full-sized avatar
:shipit:
ship it

Mark Janssen praseodym

:shipit:
ship it
View GitHub Profile
@praseodym
praseodym / FullyResolveDependencyHierarchy.java
Created May 31, 2016 19:30
Aether dependency resolution, including managed dependencies - uses git://git.eclipse.org/gitroot/aether/aether-demo.git
package org.eclipse.aether.examples;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.examples.util.Booter;
import org.eclipse.aether.graph.Dependency;
@praseodym
praseodym / gist:8402879
Last active January 3, 2016 03:29
cbench latency test, using beacon 4 threads
cbench load-generation command:
➜ et4285-masti git:(master) ~/oflops/cbench/cbench -c 10.10.2.23 -p 6633 -m 1000 -l 1000 -w 0 -s 64 -M 1000 -t
(in parallel with and on same host as)
cbench latency command:
➜ ~ ~/oflops/cbench/cbench -c 10.10.2.23 -p 6633 -m 1000 -l 25 -w 5 -s 1 -M 1 -o 1 -m 1000
➜ ~ ~/oflops/cbench/cbench -c 10.10.2.23 -p 6633 -m 1000 -l 25 -w 5 -s 1 -M 1 -o 1 -m 1000
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@praseodym
praseodym / tentamenticket.php
Created December 10, 2013 08:42
TU Delft tentamenticket generator
<?php
/**
* Clears header field to avoid injection
* http://www.anders.com/projects/sysadmin/formPostHijacking/
* http://www.davidseah.com/archives/2005/09/01/wp-contact-form-spam-attack/
*/
function preprocessHeaderField($value) {
//Remove line feeds
@praseodym
praseodym / unsign-JavaApplicationStub
Created October 3, 2013 12:25
Unsigning JavaApplicationStub
# The application is signed using a broken signature:
codesign -vvvv YourKit_Java_Profiler_12.0.6.app
# YourKit_Java_Profiler_12.0.6.app: invalid Info.plist (plist or signature have been modified)
# In architecture: x86_64
# Get a clean copy of the JavaApplicationStub
cp /System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/MacOS/JavaApplicationStub YourKit_Java_Profiler_12.0.6.app/Contents/MacOS/JavaApplicationStub
# Unsign it using the script from http://snipt.org/kto/ (linked from http://lists.apple.com/archives/java-dev/2012/Jul/msg00136.html)
unsign_snipt.rb YourKit_Java_Profiler_12.0.6.app/Contents/MacOS/JavaApplicationStub
@praseodym
praseodym / gist:6499835
Last active December 22, 2015 16:29
Homebrew qt 4.8.5 on OS X 10.9
This file has been truncated, but you can view the full file.
~ % brew install -v qt 2>&1
==> Downloading http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
Already downloaded: /Library/Caches/Homebrew/qt-4.8.5.tar.gz
tar xf /Library/Caches/Homebrew/qt-4.8.5.tar.gz
==> ./configure -prefix /usr/local/Cellar/qt/4.8.5 -system-zlib -confirm-license -opensource -nomake demos -nomake examples -cocoa -fast -release -no-3dnow -no-ssse3 -L/opt/X11/lib -I/opt/X11/include -platform unsupported/macx-clang -no-qt3support -nomake docs -arch x86_64
./configure -prefix /usr/local/Cellar/qt/4.8.5 -system-zlib -confirm-license -opensource -nomake demos -nomake examples -cocoa -fast -release -no-3dnow -no-ssse3 -L/opt/X11/lib -I/opt/X11/include -platform unsupported/macx-clang -no-qt3support -nomake docs -arch x86_64
This is the Qt for Mac OS X Open Source Edition.
You are licensed to use this software under the terms of
@praseodym
praseodym / lastfm.py
Created May 31, 2013 11:10
Textual Last.fm 'Now playing' script
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# a last.fm now playing script originally written by Brandon Sutton
# some modifications by lifning
# and more modifications by praseodym
import urllib2
import sys
@praseodym
praseodym / gist:5236933
Created March 25, 2013 12:59
SKP 2013 compiler flags
C (GCC 4.7.2):
gcc -g -Wall -O2 -std=gnu99 -static -pipe -o $DEST "$@" -lm
C++:
g++ -g -Wall -O2 -std=gnu++98 -static -pipe -o $DEST "$@"
C++11:
g++ -g -Wall -O2 -std=c++11 -static -pipe -o $DEST "$@"
Java 7:
Compileren: javac -encoding UTF-8 -d . "$@"
Runtime: java -Xrs -Xss8m -Xmx1721440k $MAINCLASS
@praseodym
praseodym / collegerama.py
Created June 21, 2012 09:26
Collegerama rip to mp4
#!/usr/bin/env python
# By Mark Janssen,
# Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
from xml.dom import minidom
from math import ceil
from collections import deque
from subprocess import call
from tempfile import mkdtemp
import java.util.Calendar;
public class JavaDay {
public static void main(String[] args) {
Calendar date = Calendar.getInstance();
date.set(2012, 6, 28);
System.out.println(date.getTime() + " is Java Day, a day where everybody speaks in Java.");
System.out.println("Why? Just because we can.\n");