Skip to content

Instantly share code, notes, and snippets.

@cgravier
cgravier / gist:3607749
Created September 3, 2012 07:57
Count lines in a project, stripping comments and empty lines (folder and subfolders, look for php, as, sql, css, java, jsp files)
find . | egrep '\.php|\.as|\.sql|\.css|\.java|\.jsp' | grep -v '\.git' | xargs cat | sed '/^\s*$/d' | wc -l
@cgravier
cgravier / gist:3857630
Created October 9, 2012 09:28
Answer to warm up exercise 2, JavaLabs #8 part a
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
Map<String, Object> contentSettings = new HashMap<String, Object>();
contentSettings.put("images", 2);
contentSettings.put("plugins", 2);
contentSettings.put("popups", 2);
contentSettings.put("audio", 2);
Map<String, Object> preferences = new HashMap<String, Object>();
preferences.put("profile.default_content_settings", contentSettings);
@cgravier
cgravier / gist:5494924
Created May 1, 2013 12:03
add this to your shell rc file and whenever you are in a subfolder of a git repo, you go back to the git project root directory. "gitroot" called outside a directory as no effect except printing to stdout that you are not currently in a git repo.
# @chgravier <[email protected]>
function gitroot {
FROM=$( pwd )
LOOKFOR=".git"
GITPROJECT=0
while [ "$(pwd)" != "/" ]
do
if [ ! -e $LOOKFOR ];
then
PARENT=$(dirname $( pwd ))
Started by timer
Building in workspace /var/lib/jenkins/jobs/cook-chrome/workspace
Checkout:workspace / /var/lib/jenkins/jobs/cook-chrome/workspace - hudson.remoting.LocalChannel@399bb4a4
Using strategy: Default
Last Built Revision: Revision de1bebd34e9ee273edeec33dc40d3e44e7cde443 (origin/HEAD, origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
Seen branch in repository origin/HEAD
Seen branch in repository origin/master
Seen 2 remote branches
@cgravier
cgravier / gist:8658389
Created January 27, 2014 22:11
Generates BSBM (http://wifo5-03.informatik.uni-mannheim.de/bizer/berlinsparqlbenchmark/) dataset of 100k, 200k, 500k, 1M, 5M, 10M, 25M, 50M triples in n-triples format.
#!/bin/bash
datasetssize=( 256 527 1369 2808 14212 28453 71431 143700 288114 )
for dim in "${datasetssize[@]}"
do
echo "Generating dataset for $dim products..."
java -cp .:lib/bsbm.jar:lib/jdom.jar:lib/log4j-1.2.12.jar:lib/ssj.jar -Xmx256M benchmark.generator.Generator -pc $dim -s nt -fn datasettmp
NB=`more datasettmp.nt | wc -l`
mv datasettmp.nt dataset_$NB.nt
echo "done."
done
*.aux
*.glo
*.idx
*.log
*.toc
*.ist
*.acn
*.acr
*.alg
*.bbl
#include <iostream>
using namespace std;
const int NPAD = 15; // on my 64 bits system
struct l {
struct l *n;
long int pad[NPAD];
};
git config --global http.proxy http://cache.univ-st-etienne.fr:3128
cd linux/tools/perf
make
cp perf /usr/bin
package fr.tse.fise2.info4.lab11;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
/**
*
* Complete this class for question