Skip to content

Instantly share code, notes, and snippets.

@dominiccooney
dominiccooney / GWT Notes
Created May 4, 2009 21:44
GWT Development Tips
An Ant rule for restarting Tomcat when building a GWT app:
<target name="deploy" depends="war" description="Copy WAR file to Tomcat">
<property name="apache.home"
location="/home/dominicc/apache-tomcat-6.0.18" />
<exec executable="${apache.home}/bin/shutdown.sh" />
<delete dir="${apache.home}/webapps/TestApp" failonerror="false" />
<copy todir="${apache.home}/webapps" file="TestApp.war" />
<exec executable="${apache.home}/bin/startup.sh" />
</target>
@dominiccooney
dominiccooney / find-svn-commit.sh
Created October 11, 2009 00:19
Find the git commit of an svn revision
#!/bin/bash
# Parses git log and finds the commit with the specified svn change
# number.
git log | awk "/^commit / {c=\$2} /git-svn-id:.*@$1 / {print c}"
# This is obsoleted by git svn find-rev rNNNN
@dominiccooney
dominiccooney / where.cmd
Created October 16, 2009 04:54
'which' for .bat files
REM Raymond Chen's replacement for Unix 'which'
@for %%e in (%PATHEXT%;.DLL) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"==""
echo %%~$PATH:i
@dominiccooney
dominiccooney / tips.md
Last active September 4, 2015 00:14
Tool Tips

diff

To diff directories recursively: diff -rupN -x .svn old-dir new-dir > my.patch
To patch: patch -p1 < my.patch

Emacs

To type a linefeed in emacs (for example, in replace-string): C-q C-j

@dominiccooney
dominiccooney / README
Created May 18, 2012 07:55
WebKit Tips
Run DumpRenderTree the way new-run-webkit-tests Does It
See Tools/Scripts/webkitpy/layout_tests/port/driver.py, Driver._start <http://code.google.com/searchframe#OAMlx_jo-ck/src/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/driver.py&type=cs&l=273>
Debug GC Issues in Chrome
Run Chrome with:
--js-flags=--expose_gc
@dominiccooney
dominiccooney / gist:59f7b750c3817eaa8e33
Last active August 29, 2015 14:13
Plotting in Julia

Preamble:

Pkg.add("Gadfly")
Pkg.add("Cairo")
using Gadfly

Dot diagram:

xs = [17.8, 14.3, 15.8, 18.0, 20.2]

plot(x=xs, y=zeros(length(xs)), Geom.point)

@dominiccooney
dominiccooney / plots.md
Last active August 29, 2015 14:13
Plotting in R

Dot diagram:

xs = c(17.8, 14.3, 15.8, 18.0, 20.2)
stripchart(xs)

Histogram:

xs = c(6.5, 2.1, 4.4, 4.7, 5.3, 2.6, 4.7, 3.0, 4.9, 4.7,
       8.6, 5.0, 4.9, 4.0, 3.4, 5.6, 4.7, 2.7, 2.4, 2.7,

2.2, 5.2, 5.3, 4.7, 6.8, 4.1, 5.3, 7.6, 2.4, 2.1,

@dominiccooney
dominiccooney / 80-column-graphics.html
Created March 25, 2015 14:38
Translate a Commodore PET BASIC graphics demo to JavaScript and HTML Canvas
<!DOCTYPE html>
<style>
canvas {
width: 640px;
height: 480px;
background: black;
}
</style>
<title>80 COLUMN GRAPHICS</title>
<canvas></canvas>
@dominiccooney
dominiccooney / index.html
Created April 6, 2015 03:34
Levy Flights and Random Walks
<!DOCTYPE html>
<style>
canvas {
width: 1000px;
height: 1000px;
background: black;
}
</style>
<canvas width="1000" height="1000"></canvas>
<script>
@dominiccooney
dominiccooney / stream.sh
Last active August 29, 2015 14:27
Try livestreaming Ubuntu desktop to YouTube using avconv
#!/bin/bash
# Adapted from http://danielj.se/2012/09/09/how-to-live-stream-your-ubuntu-desktop/
INRES="2560x1440" # input resolution
OUTRES="1920x1080"
OFFSET="0,0"
FPS="15" # target FPS
QUAL="fast" # one of the many FFMPEG preset
URL="rtmp://a.rtmp.youtube.com/live2/${STREAM_KEY:?You need to set STREAM_KEY.}"
avconv -f x11grab -s "$INRES" -r "$FPS" -g $(expr $FPS / 4 + 1) \