Skip to content

Instantly share code, notes, and snippets.

(import '(java.awt Point Graphics Frame) '(java.awt.geom AffineTransform))
(def minpoint (doto (Point.) (.setLocation 0 0)))
(def maxpoint (doto (Point.) (.setLocation 1000 1000)))
(defn draw [pts #^Frame w]
(doseq [[x y] pts] (.fillRect (.getGraphics w) x y 1 1)))
(let [w (doto (Frame. "Bitmap") (.setSize 600 700) (.setVisible true))] ())
@maxsu
maxsu / changes
Created July 12, 2012 12:09
A basic changelog writing, note taking script. Notice the bugs.
#!/bin/dash
logdir=~/logs
log=$logdir/changelog
echo '\n' >> $log
date >> $log
nano $log
@maxsu
maxsu / changes
Created July 13, 2012 12:21
Changelog record finder
# Looks for pattern PATTERN in file input.tex.
# Returns an empty-line delimited block of text surrounding the pattern.
awk
-v "pattern=PATTERN"
-v "bold=$(tput bold)"
-v "sgr0=$(tput sgr0)"
-v RS=
-v 'ORS=\n\n'
@maxsu
maxsu / ggg.pl
Created July 21, 2013 10:23 — forked from avar/ggg.pl
#!/usr/bin/env perl
use v5.10;
use warnings FATAL => "all";
use Dancer;
use URI::Escape qw(uri_escape_utf8);
# This is all the search engine does
get '/search' => sub {
given (param("q")) {
when (/^(?:!(?:ducky)?\s+|\\)(.*)/) { redirect 'http://www.google.com/search?btnI=1&q=' . uri_escape_utf8 $1 }

Working With Github Pages

The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.

Gitignore

Add _site to .gitignore. The generated site should not be uploaded to Github since its gets generated by github.

Working With Code Partials

@maxsu
maxsu / Coffee.rb
Last active December 20, 2015 10:39
Rasberry Pi: I Require only the finest Bean
#####################################################################
#
# Author: Max Suica
#
# License: CC-BY-SA
#
# Description: This is some ruby code that will allow a Rasberry Pi
# to make coffee after receiving a command from Siri.
#
# Dependencies:
@maxsu
maxsu / raspberry.log
Created July 31, 2013 20:54
Vagrant/Puppet output
--- Coffeebot/raspberry-devbox (master) vagrant up
[nox] Importing base box 'precise64'...
[nox] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.
Guest Additions Version: 4.2.0
VirtualBox Version: 4.1.18
@maxsu
maxsu / f
Last active December 20, 2015 12:09
Find Script
#!/bin/bash
# usage: myfind [-d DIR] STRING [...]
# finds all files matching any given STRING in DIR, or the current working
# directory if DIR is not provided
arg=.
args=.
dir=.
#!/bin/sh
if [ $# -ne 1 ]; then
echo "usage: $0 [raspbian image]"
exit 1
elif [ ! -f $1 ]; then
echo "Error: File $1 not found." >&2
exit 1
fi