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
// ==UserScript== | |
// @name YouTube Recommended Channel Remover | |
// @namespace pmbauer | |
// @description This extremely simple script removes the annoying sidebar on www.youtube.com. | |
// @include http://*.youtube.* | |
// @include https://*.youtube.* | |
// ==/UserScript== | |
document.getElementById("video-sidebar").style.display = "none"; |
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
(get-in {:k :v} [:k]) ;; => :v | |
(update-in {:k :v} [:k] (constantly :x)) ;; => {:k :x} | |
(get-in {:k :v} []) ;; => {:k :v} | |
(update-in {:k :v} [] (constantly {:k :x})) ;; => {nil {:k :x}, :k :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
# wget -O https://gist.github.com/pmbauer/5166100/raw/c72b880ba82dfd598c3cf27a3045833cadec32e2/install_python.sh | |
# chmod +x install_python.sh | |
# ./install_python.sh | |
#!/bin/sh | |
pushd /usr/local/src | |
echo " - Install compilers" | |
yum -y install gcc gdbm-devel readline-devel ncurses-devel zlib-devel bzip2-devel sqlite-devel db4-devel openssl-devel tk-devel bluez-libs-devel make |
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
;; based on my code from test.benchmark | |
(ns raw-threadring | |
(:import [java.util.concurrent Exchanger])) | |
(def ^Exchanger output-pipe (Exchanger.)) | |
(defn relay [state msg] | |
(if (> msg 0) | |
(send (:next state) relay (dec msg)) |
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 '[clojure.core.async :refer [chan go <! <!! >! >!!]]) | |
(defn thread-ring [size n] | |
{:pre [(> size 1)]} | |
(let [result (chan 1) | |
[head :as ring] (vec (repeatedly size #(chan 1)))] | |
(dotimes [i size] | |
(let [id (inc i) | |
in (ring i) | |
out (ring (mod id size))] |
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 '[instaparse.core :as insta]) | |
(require '[clojure.core.match :refer [match]]) | |
(def circuit-parser | |
(insta/parser | |
"<S> := (INSTRUCTION <'\n'*>)* | |
INSTRUCTION := EXP <#'\\s*->\\s*'> WIRE | |
<EXP> := ATOM | UNARY_EXP | BINARY_EXP | |
ATOM := LITERAL | WIRE | |
UNARY_EXP := OP <WHITESPACE> ATOM |
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
amd64 Linux 3.2.0-52-generic, 6 cores | |
Java HotSpot(TM) 64-Bit Server VM 23.21-b01 | |
*** Single UseConcMarkSweepGC *** | |
Runtime arguments: -XX:-UseConcMarkSweepGC | |
Evaluation count : 300 in 60 samples of 5 calls. | |
Execution time sample mean : 207.175228 ms | |
Execution time mean : 207.185921 ms | |
Execution time sample std-deviation : 1.012513 ms | |
Execution time std-deviation : 1.022277 ms |
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
FROM alpine:3.3 | |
RUN apk add --update curl drill | |
# cleanup index package cache since this is dead weight | |
# that should not be deployed | |
RUN rm -rf /var/cache/apk/* |
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
$ docker build -t extra_layers -f extra_layers.dockerfile . | |
[...] | |
$ docker history extra_layers | |
IMAGE CREATED CREATED BY SIZE COMMENT | |
6c6fffb28c43 3 weeks ago /bin/sh -c rm -rf /var/cache/apk/* 0 B | |
636b0662bc76 3 weeks ago /bin/sh -c apk add --update curl drill 3.009 MB | |
70c557e50ed6 6 weeks ago /bin/sh -c #(nop) ADD file:81ba6f20bdb99e6c13 4.794 MB |
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
$ docker build -t without_cached -f without_cached.dockerfile . | |
[...] | |
$ docker history without_cached | |
IMAGE CREATED CREATED BY SIZE COMMENT | |
19b3d76d50f5 3 weeks ago /bin/sh -c apk add --update curl drill && rm 2.26 MB | |
70c557e50ed6 6 weeks ago /bin/sh -c #(nop) ADD file:81ba6f20bdb99e6c13 4.794 MB |