Skip to content

Instantly share code, notes, and snippets.

View vartan's full-sized avatar

Michael Vartan vartan

View GitHub Profile
mkdir TO_PRINT
echo "Merging all $1"
for f in $1; do vim -f +"syn on" +"TOhtml" +"wq" +"q" $f; echo '<style>*{font:9pt menlo !important;}</style>' >> $f.html; mv $f.html TO_PRINT; done
wkhtmltopdf TO_PRINT/*.html TO_PRINT.pdf
rm -rf TO_PRINT
open TO_PRINT.pdf
@vartan
vartan / app.js
Last active September 10, 2015 16:04
/**
* app.js
*
* IR Remote Web Service
*
* @author Michael Vartan
* @version 1.0.0
*/
var express = require('express');
########################################################
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS="--uinput"
# Don't start lircmd even if there seems to be a good config file
# START_LIRCMD=false
# Don't start irexec, even if a good config file seems to exist.
sudo echo "
lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22" >> /etc/modules
sudo /etc/init.d/lirc stop
sudo /etc/init.d/lirc start
@vartan
vartan / hoverTouchUnstick.js
Created December 21, 2014 01:51
Converts :hover CSS to :active CSS on mobile devices
/**
* Converts :hover CSS to :active CSS on mobile devices.
* Otherwise, when tapping a button on a mobile device, the button stays in
* the :hover state until the button is pressed.
*
* Inspired by: https://gist.github.com/rcmachado/7303143
* @author Michael Vartan <michael@mvartan.com>
* @version 1.0
* @date 2014-12-20
*/
@vartan
vartan / SubArraySum.java
Last active March 8, 2016 20:29
SubArraySum.java
class SubArraySum {
int[][] arr;
int[][] sums;
public SubArraySum(int[][] arr) {
this.arr = arr;
this.sums = new int[this.arr.length][this.arr[0].length];
updateSums();
}
private void updateSums() {