Skip to content

Instantly share code, notes, and snippets.

@dominiccooney
dominiccooney / index.html
Created March 4, 2016 01:41
A page with "heavy" content in an iframe
<!DOCTYPE html>
<title>Hello, World</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
}
#content {
margin: 2em;
@dominiccooney
dominiccooney / julia.html
Last active May 6, 2020 15:33
Julia set in HTML5 canvas
<!DOCTYPE html>
<style>
body {
margin: 0;
padding: 0;
}
canvas {
width: 100vh;
height: 100vh;
@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) \
@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 / 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 / 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 / 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 / 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 / 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 / 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