Skip to content

Instantly share code, notes, and snippets.

@nicoulaj
nicoulaj / AuthenticatedUrlRequestUtil.as
Created January 3, 2010 15:09
A utilitary function to handle authenticated sessions when using URLRequests in ActionScript. Just reads the JSessionId from the user cookie and appends it to the URI.
/**
* Build the URL to call with the session ID
*/
public static function buildAuthenticatedURL(url : String):String
{
if (jsessionid == null) {
// Get the cookie
ExternalInterface.call('eval','window.getCookie = function () {return document.cookie};');
var cookie : String = ExternalInterface.call('getCookie');
@nicoulaj
nicoulaj / IconUtility.as
Created January 3, 2010 16:04
Provides a workaround for using run-time loaded graphics in styles and properties which require a Class reference.
/**
* Copyright (c) 2007 Ben Stucki
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
#!/bin/sh
# Manually apply fix for https://bugs.launchpad.net/ubuntu/+source/libwnck/+bug/144406
# For Ubuntu 10.10 only !
# Install required packages
sudo apt-get install compiz-dev compiz-fusion-bcop compizconfig-settings-manager intltool -y
# Download and extract sources and patch
mkdir /tmp/compiz-plugins-patch && cd /tmp/compiz-plugins-patch
wget http://releases.compiz-fusion.org/components/plugins-main/compiz-plugins-main-0.8.6.tar.gz
@nicoulaj
nicoulaj / steam-clean.bat
Created May 2, 2012 20:21
Clean Steam install files
@echo off
REM This one-liner does the same as http://sourceforge.net/projects/tikione
for /R "C:\Program Files (x86)\Steam\steamapps" %%I in ("") do if exist "%%~dpIredist" rmdir /s /q "%%~dpIredist"
@nicoulaj
nicoulaj / java-cpu-affinity-unaware.sh
Created September 6, 2012 19:17
Runtime.availableProcessors() gives info about available resources, not affinity which occurs at scheduling level
#!/bin/sh
cat > PrintAvailableProcs.java <<EOF
public class PrintAvailableProcs {
public static void main(String[] args) {
System.out.println(Runtime.getRuntime().availableProcessors());
}
}
EOF
javac PrintAvailableProcs.java
@nicoulaj
nicoulaj / clean-hsperfdata.sh
Created August 7, 2012 15:08
Clean Java hsperfdata files
#!/bin/sh
# Looks for /tmp/hsperfdata_* files leaved by unclean Java processes
# shutdowns and remove them.
# This should be executed by a user without sufficient rights to delete
# other users files...
for hsperfdata in /tmp/hsperfdata_*/*; do
ps -p `basename ${hsperfdata}` &> /dev/null || rm -vf $hsperfdata
done
public class ArrayListAddBenchmark extends ListBenchmark {
@Override
protected List<Object> newInstance() {
return new ArrayList<Object>();
}
}
@nicoulaj
nicoulaj / .gitignore
Last active December 3, 2016 17:54
PointsCloud VM environment
.vagrant
/**
* Check comparator respects its contract against a given collection.
*
* @param elements
* collection
* @param comparator
* comparator
*/
public static <T> void checkComparatorContract(Collection<T> elements, Comparator<? super T> comparator) {