Skip to content

Instantly share code, notes, and snippets.

View pcdavid's full-sized avatar

Pierre-Charles David pcdavid

View GitHub Profile
@pcdavid
pcdavid / gist:8820799
Created February 5, 2014 10:29
Simple static local HTTP server
python -m SimpleHTTPServer
@pcdavid
pcdavid / ogg2mpeg.sh
Created March 13, 2014 14:54
Conversion OGG Theora vers MPEG
#!/bin/sh
mencoder input.ogg -o output.mpeg -ovc lavc -oac mp3lame
@pcdavid
pcdavid / longnames.sh
Created March 13, 2014 14:58
Detecting the longest file names
#!/bin/sh
find . -type f | while read f; do l=$(echo $f | wc -c); echo $l $f; done | sort -n
git log --no-merges --since="50 weeks ago" --pretty=format:'%ci' | awk '{print $1}' | uniq -c | awk '{ printf $2; printf " "; for (i = 0; i < $1; i++) { printf "*" }; printf "\n" }'
# git 1.7.2.5
git_setup() {
local readonly REPO_URL="$1"
local readonly CLONE_DIR="$2"
local readonly REFSPEC="$3"
if [ -d "$CLONE_DIR/.git" ]; then
cd "$CLONE_DIR"
echo "# Reusing existing clone of $REPO_URL"
#!/bin/sh
readonly CONTRIBUTORS_RE="\(Jessy\|Mickael\|Belqassim\)"
for h in $(git log --author="$CONTRIBUTORS_RE" --format="format:%h"); do
ID=$(git show -s --pretty="format:%H" "$h")
LINES=$(git show "$h" | diffstat -s | awk '{ print $4 + $6 }')
AUTHOR=$(git show -s --pretty="format:%an" "$h")
SUBJECT=$(git show -s --pretty="format:%s" "$h")
echo "$AUTHOR\t$h\t$ID\t$LINES\t$SUBJECT"
done | sort
#!/bin/sh
# See https://git.eclipse.org/r/Documentation/cmd-query.html
# Requires http://stedolan.github.io/jq/
set -e
USER=pdavid
SERVER=git.eclipse.org
PORT=29418
PROJECT=sirius/org.eclipse.sirius
#!/bin/bash
# Usage: replace-loc.sh Luna http://www.example.com/mirrors/luna my.target
ID="$1"
URL="$2"
TARGET="${3:--}"
TEMPLATE=$(tempfile -s .xslt)
cat > $TEMPLATE <<EOF
import java.io.FileInputStream;
import java.util.jar.Manifest;
public class ManifestReader {
public static void main(String[] args) throws Exception {
Manifest man = new Manifest(new FileInputStream(args[0]));
if (man.getMainAttributes().getValue("Export-Package") != null) {
System.out.println("Export-Package: " + man.getMainAttributes().getValue("Export-Package"));
}
}
package pcd.scratch.misc.mutation;
import java.util.Collection;
import java.util.Set;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;