Skip to content

Instantly share code, notes, and snippets.

@cramsay
cramsay / tem.sh
Last active January 8, 2017 06:28
Undertale's Temmie Village "tem pay 4 colleg" script
#!/bin/bash
#Have Undertale running. Be in shop in Temmie Village with cursor over "Buy".
#This script will buy lots of "tem flake (ON SALE,)" and sell them for 1 more money per piece.
#We do this not for profit, but for tem colleg fund :3
xdotool windowactivate --sync $(xdotool search "UNDERTALE" | head -n 1); for i in {1..100}; do xdotool key --delay 120 z Down z z z z z z z z z z z z z z z z x Down z z z z z z z z z z z z z z z z z Up; done
@cramsay
cramsay / strathclyde.gpl
Created July 7, 2015 17:15
Colour palette for Strathclyde colours
GIMP Palette
Name: strath
Columns: 6
#
0 0 0 Black
0 43 92 Primary1
0 120 174 Eng
104 182 217 EngLight
167 169 172 Primary2
255 255 255 White
@cramsay
cramsay / frdm_serial
Created April 7, 2015 22:56
FRDM Serial
minicom -b 11250 -D /dev/ttyACM0
@cramsay
cramsay / mantia.sh
Last active December 29, 2015 14:29
Mantia Wallpaper downloader
#!/bin/bash
wget http://mantia.me/goodies/desktops/; cat index.html | grep -o '<a href="[^"]*' | grep _wide| sed 's/<a href="//g'|sed 's/[aZ09]*/http:\/\/mantia.me\/goodies\/desktops\//' | xargs wget -c; rm index.html
@cramsay
cramsay / enscript.sh
Last active December 29, 2015 09:19
enscript source listing
#!/bin/bash
enscript --tabsize=4 --pretty-print --color --portrait --columns=1 --fancy-header -p enscript.ps $(< sources.txt) && ps2pdf enscript.ps enscript.pdf && pdfnup --nup 2x1 --frame true --landscape --outfile source.pdf enscript.pdf
@cramsay
cramsay / ASM_example.tex
Created November 11, 2013 18:03
An example of automata diagrams using the tikz package for latex. Vending machine state machine for EE270
\documentclass{article}
%Packages for ASM diagrams
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\begin{document}
\resizebox{0.6\textwidth}{!}{
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=4.8cm,
@cramsay
cramsay / example.tex
Last active December 27, 2015 23:19
Latex KMap macros with user defined input var names (adapted from Ignasi's answer on http://tex.stackexchange.com/questions/36798/remove-vertical-lines-for-table)
\documentclass{article}
\input{kmap}
\begin{document}
\begin{Karnaugh}{i2}{i1}{o2}{o1}
\minterms{1,4}
\maxterms{0,2,3,5,6,7,8,9,10,11}
\indeterminats{12,13,14,15}
\implicant{0}{7}
\end{Karnaugh}
@cramsay
cramsay / enscript_java
Created November 6, 2013 16:19
Command to format java sources to PostScript. Line numbers, global and per file page numbers, table of contents, and user name.
enscript -q -b '$n|%N %W|$V$%/$=($p)' -Ejava -r -C --toc -p - *.java > out.ps
@cramsay
cramsay / gist:7218469
Created October 29, 2013 16:54
Smeed : C purge remaining input from scanf
/* The following macro is used to purge unwanted input */
#define consume() {char _xx; while(scanf("%c",&_xx),_xx!='\n');}
@cramsay
cramsay / gist:7218427
Created October 29, 2013 16:52
Smeed: C time macros - second based.
#include <time.h>
/* The following timing-related macros are based on the reaction.c
* versions except that they are time_t and time() specific rather
* than clock_t and clock() specific since the latter aren't
* suitable for timing I/O bound programs.
*/
static time_t _startTime,_stopTime; /* 'private' variables */
#define SNAP() (_startTime = time(NULL))
#define SHOT() (_stopTime = time(NULL))