Instantly share code, notes, and snippets.

Brendan Dawes brendandawes

View GitHub Profile
View Watson.pde
import http.requests.*;
void setup(){
size(640,640);
String txt = "The Quick Brown Fox Jumped Over the Lazy Dog";
JSONObject json = getJSONForText(txt);
PostRequest post = new PostRequest("https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2018-03-19");
post.addUser(USERNAME,PASSWORD);
post.addHeader("Content-Type", "application/json");
View seoul256-dawesome.vim
" " _____ _ ___ ___ ___ "
" " | __|___ ___ _ _| |_ | _| _| "
" " |__ | -_| . | | | | _|_ | . | "
" " |_____|___|___|___|_|___|___|___|.vim "
"
" " Low-contrast dark Vim color scheme using Seoul Colors "
"
" File: seoul256.vim
" URL: github.com/junegunn/seoul256.vim
" Author: Junegunn Choi (junegunn.c@gmail.com)
View GridMaker.pde
/**
* Grid Maker for Notes to Myself
* http://producedforuse.com
* http://brendandawes.com
*/
import dawesometoolkit.*; //http://cloud.brendandawes.com/dawesometoolkit/
import processing.pdf.*;
import controlP5.*; //http://www.sojamo.de/libraries/controlP5/
@brendandawes
brendandawes / ifttt.php
Last active Mar 24, 2018
Script for use with IFTTT to automate making Kirby blog posts from Instagram
View ifttt.php
<?php
require($_SERVER['DOCUMENT_ROOT'] . '/kirby/bootstrap.php');
// Path to a configuration file outside of a web accesible directory containing your secret pass phrase and salt.
include '/Path/To/Your/conf.inc';
if(get('id').$SALT==$IFTTT_PASS.$SALT) {
View .vimrc
set nocompatible " be iMproved, required
filetype off " required
set ignorecase
set autoindent
set cursorline
set noswapfile
set autoread
set t_Co=256
set number
set laststatus=2
@brendandawes
brendandawes / Processing Starting Template
Last active Mar 28, 2018
This is the boiler plate template I have setup each time I start a new Processing project. It includes my Dawesome Toolkit library as well as basic stuff for saving .png and .pdf files and exporting frames that you can compile into video. If you're a Vim user you can set this up to automatically be populated when you create a blank .pde file - t…
View Processing Starting Template
import dawesometoolkit.*;
import processing.pdf.*;
final String PROJECT = "project-x";
final int BACKGROUND_COLOR = #000000;
final int SECONDS_TO_CAPTURE = 60;
final int VIDEO_FRAME_RATE = 60;
int videoFramesCaptured = 0;
boolean recordVideo = false;
@brendandawes
brendandawes / Processing:videoexport
Created Feb 22, 2017
exporting frames for video
View Processing:videoexport
final int VIDEO_FRAME_RATE = 60;
final int SECONDS_TO_CAPTURE = 60;
int videoFramesCaptured = 0;
boolean recordVideo = false;
if (recordVideo){
saveFrame("export/####-video.tga");
if (videoFramesCaptured > VIDEO_FRAME_RATE * SECONDS_TO_CAPTURE){
recordVideo = false;
}
@brendandawes
brendandawes / processing:perspective
Created Feb 22, 2017
Better non clipping perspective in processing
View processing:perspective
float fov = PI/3;
float nearClip = 1;
float farClip = 100000;
float aspect;
// void setup()
aspect = float(width)/float(height);
// void draw()
@brendandawes
brendandawes / Terminal:git:exportbranches
Last active Dec 6, 2017
Export branches. Replace <outputDirectory> with the path to where you want to export the branches.
View Terminal:git:exportbranches
for branch in $(git for-each-ref --format='%(refname:short)' refs/heads);
do git archive --format zip --output <outputDirectory>/${branch}.zip $branch;
done
@brendandawes
brendandawes / index.html
Created Aug 23, 2016
p5.js: Fullscreen html and css
View index.html
<html>
<head>
<script language="javascript" type="text/javascript" src="libraries/p5.js"></script>
<script type='text/javascript' src='libraries/p5.dom.js'></script>
<script type='text/javascript' src='libraries/sylvester.js'></script>
<style>
/* http://meyerweb.com/eric/tools/css/reset/