Skip to content

Instantly share code, notes, and snippets.

@Idorobots
Idorobots / somemusings.scm
Created February 8, 2021 15:41
Some stream-based continuation whatever I wrote a year ago and just only now found unfinished. 🤷
;; Stream Returning Converter
;; Assumes syntax & macro-expanded code.
(load "compiler/ast.scm")
(load "compiler/utils.scm")
(define (src expr source)
(cond ((define? expr) (src-define expr source))
((lambda? expr) (src-lambda expr source))
((if? expr) (src-if expr source))
@Idorobots
Idorobots / streams.rkt
Last active June 20, 2019 19:56
Reactive streams?
(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 December 20, 2018 14:38
"Hackduino" board configuration - an Arduino clone using a stock ATmega8.
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
# 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

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:

// 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 January 16, 2017 20:08
Some apples to oranges comparisons.

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
template <typename T>
struct Loop {
Loop<T*> operator->() {}
};
int main(void) {
Loop<int> i, j = i->hooray; // Loops until memory is exhausted.
}
@Idorobots
Idorobots / .clj
Last active January 8, 2016 20:14
:3
(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"
;; 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)