Skip to content

Instantly share code, notes, and snippets.

@Idorobots
Idorobots / streams.rkt
Last active Jun 20, 2019
Reactive streams?
View streams.rkt
(define-struct subscriber (on-subscription on-next on-error on-complete))
(define-struct subscription (on-request on-cancel))
(define-struct publisher (on-subscriber on-publish on-error on-complete))
(define (subscription on-request on-cancel)
(make-subscription on-request on-cancel))
(define (request sub n)
((subscription-on-request sub) n))
@Idorobots
Idorobots / gist:d04b599be1eec880b0d44325097d8fa5
Created Dec 20, 2018
"Hackduino" board configuration - an Arduino clone using a stock ATmega8.
View gist:d04b599be1eec880b0d44325097d8fa5
hack.name=Hackduino
hack.vid.0=0x2341
hack.pid.0=0x0043
hack.vid.1=0x2341
hack.pid.1=0x0001
hack.vid.2=0x2A03
hack.pid.2=0x0043
hack.vid.3=0x2341
View gist:285b909c4a559eb2e7b4be606b1d76e2
# enable
curl 'http://192.168.8.1/api/user/hilink_login' -H 'Pragma: no-cache' -H 'Origin: http://192.168.8.1' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.9' -H 'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Mobile Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: */*' -H 'Cache-Control: no-cache' -H 'X-Requested-With: XMLHttpRequest' -H 'Cookie: SessionID=+B+tlxt4VMFx4hXJ0Au2OPt/WZj+nDKA3zHSzViJq+mtzRMSzR/HXxYfddkk9Cqly11bArbDs7TUr9Dpuw+WqooU3SCNR+VQS7G5esdNtiWgKdu+lm16bgYWEcr3Thg4' -H 'Connection: keep-alive' -H 'Referer: http://192.168.8.1/html/modifypassword.html' -H '__RequestVerificationToken: bA5p+yJcEI2vBFF9R6EVRbWppMmW1vMr' --data '<?xml version="1.0" encoding="UTF-8"?><request><hilink_login>1</hilink_login></request>' --compressed
# disable
curl 'http://192.168.8.1/api/user/hilink_login' -H 'Pragma: no-cache' -H 'Origin: http://192.168.8.1' -H 'Acce
View keybase.md

Keybase proof

I hereby claim:

  • I am Idorobots on github.
  • I am kajtek (https://keybase.io/kajtek) on keybase.
  • I have a public key whose fingerprint is 115F 54A0 0733 1F81 FBCD 8E4D 652F 6916 DD61 728E

To claim this, I am signing this object:

View warttest.scala
// SBT version 0.13.9
// Scala version 2.11.8
// Wartremover version 2.0.2
// Scalatest version 3.0.0
package warttest
import org.scalatest.{FunSpec, Matchers}
class WartAnySpec extends FunSpec with Matchers {
@Idorobots
Idorobots / benchmark.md
Last active Jan 16, 2017
Some apples to oranges comparisons.
View benchmark.md

Benchmark

2 GHz, 2-core PowerPC 970 made in 2003 versus 4-core 0.9 GHz BCM2709 made in 2015 versus 3.5 GHz, 8-thread, 4-core i7-6700HQ made in 2015:

Matrix product:

# stress-ng --cpu 2 --cpu-method matrixprod --timeout 120 --perf --metrics-brief
stress-ng: info:  [6878] stressor      bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
stress-ng: info:  [6878]                          (secs)    (secs)    (secs)   (real time) (usr+sys time)
stress-ng: info:  [6878] cpu               2169    120.08    239.74      0.02        18.06         9.05
View loop.cpp
template <typename T>
struct Loop {
Loop<T*> operator->() {}
};
int main(void) {
Loop<int> i, j = i->hooray; // Loops until memory is exhausted.
}
View .clj
(defn fmt [f args]
(->> f
(re-seq #"#\{([^\}]+)\}")
(map (juxt (comp re-pattern #(replace % "}" "\\}") #(replace % "{" "\\{") first)
(comp args keyword second)))
(reduce #(apply replace %1 %2) f)))
;; (fmt "#{foo} is a #{bar}" {:foo "foo" :bar "bar"})
;; => "foo is a bar"
View speedbar_config.el
;; Speedbar stuff:
(require 'speedbar)
(require 'sr-speedbar)
(eval-after-load "speedbar"
(lambda ()
(speedbar-add-supported-extension ".erl")
(speedbar-add-supported-extension ".clj")))
(setq speedbar-show-unknown-files t)
View cep.scm
(letrec ((monitor (lambda ()
(task-info)
(sleep 10000)
(monitor)))
(notify (lambda (prefix t)
(assert! `(notify ,prefix ,(random)))
(sleep t)
(notify prefix t)))
(listen (lambda ()
(let ((m (recv)))
You can’t perform that action at this time.