Skip to content

Instantly share code, notes, and snippets.

@jcla1
jcla1 / springer-free-maths-books.md
Created December 28, 2015 17:48 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@jcla1
jcla1 / activityLog.hs
Created July 4, 2014 21:27
Haskell activity log script
import Data.Function (on)
import Data.List (sort, sortBy, groupBy, nub)
import Data.List.Utils (replace)
import Data.Ord (comparing)
import Data.Either (rights)
import Control.Monad (liftM)
import System.Environment (getArgs)
import Text.Parsec.Error (ParseError)
@jcla1
jcla1 / maybe.py
Created May 18, 2014 14:56 — forked from senko/maybe.py
# maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <senko.rasic@goodcode.io>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
public class AccessBenchmark {
private final long N = 1000000000;
private static final int M = 1;
private LocalClass instanceVar;
private class LocalClass {
public void someFunc() {}
}
function build_hierarchy(list, key, tuple_func) {
var direct_hierarchy = list
.map(tuple_func)
.reduce(function(obj, tuple) {
tuple[0] in obj ? obj[tuple[0]].push(tuple[1]) : obj[tuple[0]] = [tuple[1]];
return obj;
}, {});
var hierarchy = Object.keys(direct_hierarchy)
.reduce(function(obj, type) {
PSH 0
PSH 1
LOOP: SUM 2
OUT
DUP
JMP EO_CHECK
EO_CONT: OUT
POP
SSZ
PSH 20
@jcla1
jcla1 / .gitmodules
Last active December 23, 2015 01:48
Cron and Applescript files for personal tracking
[submodule "running_programs"]
path = running_programs
url = https://gist.github.com/6554497.git
[submodule "chrome_status"]
path = chrome_status
url = https://gist.github.com/6525572.git
[submodule "frontApp"]
path = frontApp
url = https://gist.github.com/6522769.git
@jcla1
jcla1 / running_programs.applescript
Last active December 23, 2015 00:29
Print a comma delimited list of user programs running, excluding Finder.
tell application "System Events"
set programs to get name of every process whose background only is false and name is not "Finder"
set AppleScript's text item delimiters to {","}
programs as string
end tell
@jcla1
jcla1 / chrome_status.applescript
Last active December 22, 2015 20:19
Get the URL of Chrome's active tab.
tell application "System Events"
set chromeRunning to (length of (get name of every process whose name is "Google Chrome") is greater than 0)
set chromeInFocus to ((name of first application process whose frontmost is true) is "Google Chrome")
set activeURL to ""
set numTabs to 0
if chromeRunning then
tell application "Google Chrome"
set normalWindows to (windows whose mode is not "incognito")
#!/bin/sh
# computer activity data collection for http://jehiah.cz/one-two/
# initially by Jehiah Czebotar. Modified by Joseph Adams
FILE="data/misc/activity_log/`date +%Y%m%d`.log"
FRONT_APP="data/misc/cron/frontApp/frontApp.applescript"
function log_activity()
{
local UTC=`date "+%s,%Z"`