Skip to content

Instantly share code, notes, and snippets.

@MiyacoGBF
MiyacoGBF / 01_NieR_FAR.md
Last active March 14, 2024 11:25
How to Install FAR, HD Texture Pack, and ReShade (GShade) for NieR:Automata on Linux
@pingles
pingles / bytes_to_int.clj
Created September 22, 2011 17:01
Clojure code to convert a byte array to an integer
(defn bytes-to-int
([bytes]
(bytes-to-int bytes 0))
([bytes offset]
(reduce + 0
(map (fn [i]
(let [shift (* (- 4 1 i)
8)]
(bit-shift-left (bit-and (nth bytes (+ i offset))
0x000000FF)
@techhazard
techhazard / Readme.md
Last active January 26, 2024 16:23
NixOS: PCI Passthrough

PCI Passthrough

Warning: unfinished (but successfull!)

I did PCI passthrough on Archlinux and Debian with the old PCI-stub method (this was pre-4.0 era). And later I did PCI passthrough on the 4.1+ kernels on Arch and Ubuntu (16.10 I think?).

This is my attempt at doing the same on Nixos.

Requirements

@sunng87
sunng87 / reflection.clj
Created November 20, 2015 10:04
clojure: access private field/method via reflection
(defn invoke-private-method [obj fn-name-string & args]
(let [m (first (filter (fn [x] (.. x getName (equals fn-name-string)))
(.. obj getClass getDeclaredMethods)))]
(. m (setAccessible true))
(. m (invoke obj args))))
(defn private-field [obj fn-name-string]
(let [m (.. obj getClass (getDeclaredField fn-name-string))]
(. m (setAccessible true))
(. m (get obj))))
@kennyjwilli
kennyjwilli / defspec-test.clj
Created November 5, 2016 01:37
clojure.spec.test integration with clojure.test
(defmacro defspec-test
([name sym-or-syms] `(defspec-test ~name ~sym-or-syms nil))
([name sym-or-syms opts]
(when t/*load-tests*
`(def ~(vary-meta name assoc :test `(fn []
(let [check-results# (clojure.spec.test/check ~sym-or-syms ~opts)
checks-passed?# (every? nil? (map :failure check-results#))]
(if checks-passed?#
(t/do-report {:type :pass
:message (str "Generative tests pass for "