Skip to content

Instantly share code, notes, and snippets.

View jasalt's full-sized avatar

Jarkko Saltiola jasalt

View GitHub Profile
@jasalt
jasalt / gist:9418690
Created March 7, 2014 19:55
xmsi-mode by Xah Lee
;;-*- coding: utf-8 -*-
;; xmsi-math-symbols-input.el -- a mode to input math chars
;; Copyright © 2010, 2011 by Xah Lee
;; Author: Xah Lee ( http://xahlee.org/ )
;; Keywords: math symbols, unicode, input
;; You can redistribute this program and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2.
@jasalt
jasalt / thinkstrobo.py
Created March 16, 2014 19:01
Thinkpad acpi-linux Thinklight® strobo
import os
import time
sleeptime = 0.03
def cycle_light():
while True:
os.system("echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness")
time.sleep(sleeptime)
@jasalt
jasalt / savut-tuli.ino
Created September 16, 2014 17:27
Multiplekseristä tuli savut.
// Multiplexer selector pins
int mpA = 2; // Yellow cable
int mpB = 3; // Red cable
int mpC = 4; // Gray cable
int mpIN = A1; // Purple COM OUT/IN
// Number of potentiometers
const int potCount = 8;
// Array for voltages of potentiometers
(prelude-require-packages '(window-numbering
key-chord
iy-go-to-char
multiple-cursors
;; google-translate
writeroom-mode
dired-details
dired+
dedicated
smex
from flask import Flask
from secrets import g_user, g_pass
from datetime import datetime
app = Flask(__name__)
import gspread
# Helpers
@jasalt
jasalt / app.js
Created October 22, 2014 02:08
pebble-coffee-watch-app
/* Helpers */
// Send request to server
var sendRequest = function(substance){
var req = new XMLHttpRequest();
req.open('GET', 'http://XXsecretXX:YY/' + substance, true);
req.onload = function (e) {
if (req.readyState === 4) {
if (req.status === 200) {
@jasalt
jasalt / usbreset.c
Last active September 5, 2015 07:31 — forked from x2q/usbreset.c
/* usbreset -- send a USB port reset to a USB device
*
* Compile using: gcc -o usbreset usbreset.c
*
*
* */
@jasalt
jasalt / heroku-caffeine.py
Created September 5, 2015 13:30
Heroku Caffeine, free node daytime keepalive script
# "Free dynos are allowed 18 hours awake per 24 hour period."
# This script keeps the free Heroku dyno awake during daytime.
# During night, user needs to wait ~10s for server wakeup.
# Tested on Python 2.7.6, should work on *nix machines.
# (On Python 3 urllib2 is changed to urllib3..)
# Configuration & Usage:
# - Setup server endpoints in KEEP_AWAKE_SERVERS env var, separated by space.
# eg. `export KEEP_AWAKE_SERVERS="http://app955.herokuapp.com http://asd.me"`
@jasalt
jasalt / iterm
Last active September 21, 2015 19:02 — forked from bobthecow/tab.bash
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line to currently running ITerm2
# session
#
# Author: Justin Hileman (http://justinhileman.com)
# Modified by: Jarkko Saltiola (http://saltio.la)
#
# Installation:
# Add this file path
@jasalt
jasalt / demo5.sql
Created February 20, 2013 10:00
sqldemo5_t6
-- 6. Kaikille niille projekteille, jotka ovat tulleet toimeen ilman koirrua
-- (onimi = ’koirru’), on myönnetty ylimääräinen 5 000 euron
-- budjettikorotus. Päivitä vastaavasti tietokantaa. [päivitys koskee
-- seuraavia projekteja: Tuubero, Talluke, Iklore, Tuomake, Tuma, Teklari,
-- Aboma]
UPDATE projekti
SET budjetti = budjetti + 5000
WHERE ptun NOT IN
(SELECT ptun