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
@nicoulaj
nicoulaj / SecurityProvidersAndAlgorithms.java
Created August 17, 2010 20:06
List all Java Security providers and algorithms available in the environment.
import java.security.Provider;
import java.security.Security;
import java.util.Enumeration;
public class SecurityProvidersAndAlgorithms {
public static void main(String[] args) throws Exception {
try {
Provider p[] = Security.getProviders();
for (int i = 0; i < p.length; i++) {
System.out.println(p[i]);
#!/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 / build-zsh.sh
Created November 25, 2010 20:19
Build Zsh from sources on Ubuntu
#!/bin/sh​
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
# Some packages may be missing
sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo
git clone git://zsh.git.sf.net/gitroot/zsh/zsh
cd zsh
@nicoulaj
nicoulaj / svn-fix-props.pl
Created September 8, 2011 12:40
Recursively fix SVN properties using auto-props configuration (by Gustavo Chaves)
#!/usr/bin/perl
# Copyright (C) 2008 by CPqD
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@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 / 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
@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