Skip to content

Instantly share code, notes, and snippets.

@pilhokim
pilhokim / private.xml
Last active July 6, 2016 06:58
Karabiner private.xml setting for Microsoft Sculpt ergonomic keyboard/mouse and IME switching.
<?xml version="1.0"?>
<root>
<deviceproductdef>
<productname>SCULPT_ERGONOMIC</productname>
<productid>0x07a5</productid>
</deviceproductdef>
<item>
<name>
MS Sculpt mouse reverse scroll
</name>
# Node-WebKit CheatSheet
# Download: https://github.com/rogerwang/node-webkit#downloads
# Old Versions: https://github.com/rogerwang/node-webkit/wiki/Downloads-of-old-versions
# Wiki: https://github.com/rogerwang/node-webkit/wiki
# How: https://github.com/rogerwang/node-webkit/wiki/How-node.js-is-integrated-with-chromium
# 1. Run your application.
# https://github.com/rogerwang/node-webkit/wiki/How-to-run-apps
fs = require('fs')
http = require('http')
https = require('https')
express = require('express')
path = require 'path'
_ = require('underscore')
sessionToken = "secretString"
secretUploadPass = "Change me"
secretPass = "Change me too"
@pilhokim
pilhokim / classtype.sql
Last active August 29, 2015 14:11
PgSQL function to perform direct reverse geocoding on Nominatim database. To run first import class type data running classtype.sql first. Then run gps_get_placeids() and gps_reverse_geocode_from_placeids() in sequence. If you want to perform a single reverse geocoding, then use gps_get_address at the bottom.
--
-- PostgreSQL database dump
-- SQL version of getClassTypes array defined in Nominatim/lib.php
-- Excerpted and transformed for PQSQL by Pil Ho Kim, 2014
-- This creates a classtype table and put class type data extracted from Nominatim source codes
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
@pilhokim
pilhokim / getAddress.sql
Last active August 29, 2015 14:10
getAddress SQL for the OSM database created using http://mysqlserverteam.com/mysql-5-7-and-gis-an-example/
-- Source: http://mysqlserverteam.com/mysql-5-7-and-gis-an-example/
-- getAddress SQL for the OSM database
DELIMITER ;;
CREATE PROCEDURE `getAddress`(IN lat1 double, IN log1 double)
BEGIN
SELECT
nodetags.id,
GROUP_CONCAT(CONCAT(nodetags.k,"=",nodetags.v) SEPARATOR ',') AS address,
fp.distance_in_meters
FROM
@pilhokim
pilhokim / gps_trajectory_extractor_from_android_keyvalue.sql
Created June 5, 2014 14:30
SQL script to extract GPS information from Android sensor key-value storage. It performs the trajectory extraction from the GPS traces.
-- Prepare temporary table
CREATE TABLE android_gpslocationevent LIKE elog_user_test3_android;
-- Extract GPS location data from the android sensor data table
INSERT IGNORE INTO android_gpslocationevent
SELECT *
FROM elog_user_test3_android
WHERE sensor = 'GPSLocationEvent';
-- Prepare GPS table
@pilhokim
pilhokim / zoneinfo.sql
Created February 28, 2014 14:33
My Mac zone info file to fill up MySQL timezone* tables
This file has been truncated, but you can view the full file.
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('Africa/Abidjan', @time_zone_id);
INSERT INTO time_zone_transition (Time_zone_id, Transition_time, Transition_type_id) VALUES
(@time_zone_id, -1830383032, 1)
;
@pilhokim
pilhokim / mail-usbread.py
Created January 9, 2014 13:18
Excerpted from https://github.com/repoman/rpiips/tree/master/rpiips mail-ip.py is modified to work with my RPi configuration
#!/usr/bin/python
import sys, getopt, subprocess, smtplib, re
# read arugments
def main(argv):
message = ''
output = ''
try:
opts, args = getopt.getopt(argv,"hm:o",["message=","output="])
@pilhokim
pilhokim / onInsertUsb.sh
Created January 9, 2014 13:15
This watches the changes when USB inserting event happens. To unify the USB media name, sudo edit /etc/fsab to insert /dev/usbkey /mnt/usb vfat ro,noauto,user,exec 0 0 Within the content, mail-usbread.py should be additionally downloaded from my account.
#!/bin/bash
# RPI USB stick backup script running on USB insert event
# by Pil Ho Kim, pilhokim@gmail.com
# Revision History
# January 2nd, 2014: Modified from the old USB link insert detection version
# Refereces
# USB stick insertion detection: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=32&t=41056