Skip to content

Instantly share code, notes, and snippets.

View timpulver's full-sized avatar

Tim Pulver timpulver

View GitHub Profile
@timpulver
timpulver / photo_journal.md
Created February 27, 2013 15:29
[dayone_export] Jinja2 style template for dayone_export (https://github.com/nathan11g/dayone_export/blob/master/dayone_export/templates/default.html), a tool for exporting day one journals to markdown / html / plain text. This template can be used to export day one journals to markdown format including photos / images. Place the template in your…

#Journal Entries

{% for entry in journal %} ##{{ entry['Date'] | format }}

{% if entry.place() %} {{ entry.place() }}, {% endif %} {{ entry['Date'] | format('%-I:%M %p %Z') }} {% if 'Photo' in entry %}

@timpulver
timpulver / GetNameAndTitleOfActiveWindow.scpt
Created February 11, 2013 10:38
[AppleScript] Get Name of active window | Returns the name / title of the active (frontmost) window
# taken from user Albert's answer on StackOverflow
# http://stackoverflow.com/questions/5292204/macosx-get-foremost-window-title
# tested on Mac OS X 10.7.5
global frontApp, frontAppName, windowTitle
set windowTitle to ""
tell application "System Events"
set frontApp to first application process whose frontmost is true
set frontAppName to name of frontApp
@timpulver
timpulver / openGl_with_Processing_2.0_in_Eclipse.txt
Created December 5, 2012 16:29
[Processing, Eclipse] Using OpenGL in Eclipse with Processing 2.0
// Copied from Processing.org Forum user voodoc
I had a hard time finding the answer for this, so I thought I would put this here.
1. Create new Java Project.
2. Create a new folder in you project folder named "lib".
3. Right click "lib" and import all of the files contained in: \ Processing_2.0b3 \ core \ library.
4. Shift click three jar's: core.jar, gluegen-rt.jar, & jogl-all.jar.
5. Right click one of the selected files and go to "Build Path" and then "Add to Build Path".
6. Right click on one of the new .jar's in your build path above, and go to "Build Path" and then "Configure Build Path".
7. In this menu, expand both gluegen-rt.jar and jogl-all.jar.
@timpulver
timpulver / IntersectionWithBlend.pde
Created December 4, 2012 15:23
[Processing] Graphical intersection ellipse
/*
* Copied from: Stack Overflow user V.K. http://stackoverflow.com/users/1690199/v-k
* Tags: Intersection, ellipse, blend, intersect, difference, overlap, overlapping
*
*/
PGraphics c;
PGraphics d;
void setup() {
size(300, 300);
@timpulver
timpulver / writeToFile.sh
Created November 29, 2012 00:09
[Bash] Write text to file
echo "THIS IS STUFF FOR THE FILE" > index.html
the single > just overwrites anything in there.
echo "THIS IS STUFF FOR THE FILE" >> index.html
the dual >> appends the stuff at the end.
@timpulver
timpulver / ResizableSketch.pde
Created November 24, 2012 15:21
[Processing] Make window/frame resizable
void setup(){
frame.setResizable(true);
//...
}
// tags: processing, p5, frame, java, resize, window
@timpulver
timpulver / rotateImage.pde
Created October 17, 2012 14:46
[Processing] Rotate Image using a direction vector
/**
* Rotates an image around an angle
* For this the direction vector dir will be used.
* E.g. if you want to code something like Asteroids:
* A rocket, which is always pointing towards the direction it is flying to...
* For details about atan2 see here: http://www.processing.org/reference/atan2_.html
*
* keywords: atan, atan2, sin, cos, tan, vector, vektor, math, mathe, winkel,
* angle, rotation, processing.org, 360, TWO_PI, origin, ursprung, image, bild
*/
@timpulver
timpulver / dinPageFormats.pde
Created October 14, 2012 09:18
[Processing] Specifying PDF page size in Processing (Processing 2.0 alpha)
import processing.pdf.*;
import com.lowagie.text.PageSize;
import com.lowagie.text.Rectangle;
/**
* Hack to use dinA paper formats
* Originally posted by http://toxi.co.uk, I made small changes to use it with Processing 2.0 alpha.
*/
@timpulver
timpulver / deleteFoldersWithOneFile.pde
Created September 26, 2012 12:29
[Processing] Delete all folders with only one file
String parentFolder = "M:\\INSERT_PARENT_DIR_HERE";
void setup(){
File tmpDir;
File fParentFolder = new File(parentFolder);
println("Scanning " + fParentFolder.getAbsolutePath());
println("Folder exists: " + fParentFolder.exists());
File[] folderList = fParentFolder.listFiles();
println("Number of files/folders: " + folderList.length);
println("-----------------------------------");
@timpulver
timpulver / threshold.pde
Created September 25, 2012 12:58
[Processing] Image Threshold [Image manipulation, effect]
class Threshold{
/**
* Returns a new PImage with threshold thresh in Grayscale.
* All coulours will be splitted according to their
* brightness between black and white.
*/
PImage threshold(PImage pi, int thresh){
if(pi==null || thresh < 0 || thresh > 255){ // invalid argument
println("threshold(): PImage == 0 or threshold value not in range [0..255]");