Skip to content

Instantly share code, notes, and snippets.

View jasalt's full-sized avatar

Jarkko Saltiola jasalt

View GitHub Profile
@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
@jasalt
jasalt / demo5.sql
Created February 20, 2013 12:00
tehtävää
-- 1. Hae keveimmän punaisen osan toimittajien nimet käänteisessä
-- aakkosjärjestyksessä [Tantola, Kiirola, Karola Oy]
SELECT tnimi
FROM toimittaja
WHERE ttun IN
(SELECT ttun -- toimitukset joissa mukana osa
FROM toimitus
WHERE otun IN
(SELECT otun -- Osat jotka..
import web
from oauthlib.oauth1 import Server
from oauthlib.common import safe_string_equals
urls = ("/.*", "hello")
app = web.application(urls, globals())
class OAuthProvider(Server):
''' https://oauthlib.readthedocs.org/en/latest/server.html '''
@jasalt
jasalt / burn.sh
Created March 25, 2013 18:59
Bash cpu stress test
#!/bin/bash
while : ; do
true
done
@jasalt
jasalt / namesub.py
Created April 5, 2013 20:24
rename subtitle files to match video files in same folder
'''
Rename subtitle files in same folder to match the movie file
(for xbmc-share folder)
Jarkko Saltiola 2013
'''
import os
import re
video_types = ["mkv","avi"]
@jasalt
jasalt / gist:6064368
Created July 23, 2013 17:34
Begginner robot programming course arduino code. (JYU, December/2012) Photos: http://www.flickr.com/photos/93259094@N05/sets/72157634761276095/ Video: http://youtu.be/jIrg4B3pWpg
/*
========== GPIO WIRING ==========
===== INPUT =====
0 Battery input voltage (halved) (TODO: stop robot if voltage < 6.8V)
1 Bump (unused)
2
3
4
5
@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