Skip to content

Instantly share code, notes, and snippets.

@jkpr
jkpr / runner.py
Created September 19, 2019 00:15
Runner
from collections import defaultdict
import logging
from pprint import pprint
import random
import queue
import threading
from solution import solution
@jkpr
jkpr / responseFromHttpUrl.java
Created January 30, 2018 22:22
Java read return result from URL
/**
* This method returns the entire result from the HTTP response.
*
* See https://stackoverflow.com/questions/309424/read-convert-an-inputstream-to-a-string
*
* @param url The URL to fetch the HTTP response from.
* @return The contents of the HTTP response.
* @throws IOException Related to network and stream reading
*/
public static String getResponseFromHttpUrl(URL url) throws IOException {
@jkpr
jkpr / gitFollowFile.sh
Created September 26, 2017 14:01
Git show commits that changed a specific file
git log --follow filename
# https://stackoverflow.com/questions/3701404/list-all-commits-for-a-specific-file
@jkpr
jkpr / gitDiffParent.sh
Created September 26, 2017 13:59
Git diff commit with its parent
git diff 15dc8^!
git show 15dc8
# https://stackoverflow.com/questions/436362/how-to-diff-a-commit-with-its-parent
@jkpr
jkpr / findFileExt.sh
Created September 26, 2017 13:49
Find all files with specific extension
find $directory -type f -name "*.mp4"
@jkpr
jkpr / combine_tables.sh
Created July 3, 2017 15:58
SQLite merge table of one database into table of another
$ sqlite3 db1.sqlite
> ATTACH '/path/to/db2.sqlite' AS mergeme;
> BEGIN;
> INSERT INTO photos SELECT * FROM mergeme.photos WHERE mergeme.photos.orig_md5 NOT IN (SELECT orig_md5 FROM photos);
> COMMIT;
> DETACH mergeme;
@jkpr
jkpr / loggingExample1.txt
Last active November 3, 2022 20:02
Output of current logging functionality, 23 September 2015
09-23 15:39:43.273 27543-28352/org.odk.collect.android D/LogHandler﹕ EP, 'null', '1443037182942', 'group./HHQ/name_grp[1]/your_name[1]', ''
09-23 15:39:43.273 27543-28352/org.odk.collect.android D/LogHandler﹕ EP, 'null', '1443037183273', 'group./HHQ/name_grp[1]/your_name_check[1]', ''
09-23 15:39:50.288 27543-28352/org.odk.collect.android D/LogHandler﹕ LP, 'null', '1443037189949', 'group./HHQ/name_grp[1]/your_name[1]', ''
09-23 15:39:50.290 27543-28352/org.odk.collect.android D/LogHandler﹕ LP, 'null', '1443037190289', 'group./HHQ/name_grp[1]/your_name_check[1]', 'no'
09-23 15:39:50.324 27543-28352/org.odk.collect.android D/LogHandler﹕ EP, 'null', '1443037190324', 'question./HHQ/name_typed[1]', ''
09-23 15:39:58.510 27543-28352/org.odk.collect.android D/LogHandler﹕ LP, 'null', '1443037198510', 'question./HHQ/name_typed[1]', 'Awen'
09-23 15:39:58.827 27543-28352/org.odk.collect.android D/LogHandler﹕ EP, 'null', '1443037198826', 'group./HHQ/date_group[1]/system_date[1]', ''
09-23 15:39:58.827 27543-28352