Skip to content

Instantly share code, notes, and snippets.

@contumaxcs
contumaxcs / R: %||%
Created June 23, 2015 15:00
R: %||%
`%||%` <- function(a, b) if (is.null(a)) b else a
histTreshold <- function(hdata, treshold, freq=FALSE) {
if (freq) {
tresh <- hdata$density
} else {
tresh <- hdata$counts
}
tresh <- tresh<treshold
@contumaxcs
contumaxcs / gist:4727082
Created February 6, 2013 23:59
Python: Timer
#!/usr/bin/python
import threading
import time
class TimerClass(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.event = threading.Event()
@contumaxcs
contumaxcs / gist:4666641
Created January 29, 2013 18:57
Sublime2(ubuntu): Key Bindings-User
[
// R
{ "keys": ["alt+-"], "command": "insert_snippet", "args": {"contents": " <- " }},
{ "keys": ["shift+ctrl+/"], "command": "insert_snippet", "args": {"contents": "#' " }},
// SublimeREPL
{ "keys": ["alt+shift+r"], "command": "repl_transfer_current", "args": {"scope": "file"}},
{ "keys": ["ctrl+shift+r"], "command": "repl_transfer_current", "args": {"scope": "lines"}},