This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
target_window=vncviewer | |
keys_disabled=false | |
i3-msg -t subscribe -m '[ "window" ]' | jq --unbuffered -r '.| select(.change == "focus") | .container.window_properties.instance' | | |
while read -r window; | |
do | |
if [ "$window" == "$target_window" ] && [ "$keys_disabled" == false ]; then | |
i3-msg mode pass-through | |
keys_disabled=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* C++ code produced by gperf version 3.1 */ | |
/* Command-line: gperf /home/sebastien/dev/myhtml4j/cpp/src/../scripts/attributes.gperf */ | |
/* Computed positions: -k'1,3,5,$' */ | |
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | |
&& ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | |
&& (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | |
&& ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | |
&& ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | |
&& ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns user) ;; tried in clojure 1.10.1 | |
(defmacro parse [& bodies] | |
;; Macro arguments have proper meta information: | |
(println "bodies" bodies "with meta" (map meta bodies)) | |
;; But just the roots of their arguments, not their children: (the symbols in the example below) | |
(println "bodies children have meta" (map #(map meta %) (rest &form))) | |
;; The root of &form has meta information: | |
(println "&form" &form "with meta" (meta &form)) | |
;; The form children have meta information again (except the first one, which is the macro name): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns user) | |
(defmacro parse [& bodies] | |
(println "bodies" bodies "with meta" (map meta bodies)) | |
(println "bodies children have meta" (map #(map meta %) (rest &form))) | |
(println "form" &form "with meta" (meta &form)) | |
(println "form children have meta" (map meta &form)) | |
(println "form grand-children have meta" (map #(map meta %) (rest &form)))) ;; "rest" skips "parse" which is not a list | |
(parse (a b) (c d)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns zprint-issue-01.core-test | |
(:require [clojure.test :as t])) | |
(defn- cast-to-symbol [v] | |
(cond | |
(var? v) (let [n (.ns v) | |
v (.sym v)] | |
(symbol (str n) (str v))) | |
(symbol? v) v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[:rule | |
[:morphism | |
_0 | |
[:object _0 _1] | |
[:object _0 _2] | |
[:compose | |
[:morphism _0 [:object _0 _1] [:object _0 _1] :identity] | |
[:morphism _0 [:object _0 _1] [:object _0 _2] _3]]] | |
[:morphism _0 [:object _0 _1] [:object _0 _2] _3]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -std=c++11 -o foo foo.cpp | |
#include <iostream> | |
using namespace std; | |
int main() { | |
int a[5] = {0,0,0,0,0}; | |
a[1] = 3; | |
2[a] = 4; | |
for (int f : a) { | |
cout << f << " "; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn key-value-cache | |
"Wraps the async function `(operation [& args] output-channel)` by memoizing it in the key-value-store. | |
The returned function has the same signature as `operation`. | |
You can optionally provide the following named parameters: | |
`:key-fn` is used to serialize the key and takes the same arguments as `operation` (default format: EDN). | |
`:serialize` and `:deserialize` take a single argument and serialize/deserialize it (default format: EDN). | |
" | |
[store operation & {:keys [key-fn serialize deserialize forced-update?] | |
:or {key-fn pr-str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function conversion() { | |
SRC=$1 | |
DST=${SRC%.*}.mp3 | |
if [ ! -f "$DST" ]; then | |
echo "converting $SRC -> $DST..." | |
ffmpeg -i "$SRC" -c:a libmp3lame -q:a 2 "$DST" &> /dev/null | |
else | |
echo "skipping $SRC -> $DST" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[vertigo.core :as v]) | |
(require '[vertigo.structs :as s]) | |
(s/def-typed-struct point :x s/int64 :y s/int64) | |
(def ^:point points (v/marshal-seq point (repeat 100 {:x 1 :y 2}))) | |
(def ^:s/int64 numbers (v/marshal-seq s/int64 (repeat 100 1))) | |
(v/doreduce [x (v/over points [_ :x])] | |
[sum 0] | |
(+ x sum)) |
NewerOlder