This file contains hidden or 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
aws kms encrypt \ | |
--key-id 'arn:aws:kms:eu-............' \ | |
--plaintext fileb://input-filename \ | |
--output text \ | |
--query CiphertextBlob \ | |
| base64 --decode > encrypted_filename | |
aws kms decrypt \ | |
--ciphertext-blob fileb://encrypted_filename \ | |
--query Plaintext \ |
This file contains hidden or 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
fn art_slice(ln: &str, step: usize, idx: usize) -> &str { | |
let ofs = step * idx; | |
&ln[ofs..(ofs + step)] | |
} | |
fn ch_index(ch: char) -> usize { | |
let lookup_ch = if 'A' <= ch && ch <= 'Z' { ch } else { '?' }; | |
"ABCDEFGHIJKLMNOPQRSTUVWXYZ?".chars().position(|x| x == lookup_ch).unwrap() | |
} |
This file contains hidden or 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 | |
set -e -x | |
FILE=$1 | |
BAK=$FILE.eol.bak | |
cp $FILE $BAK | |
cat $BAK | sed -r "s/[ \t]+$//" > $FILE |
This file contains hidden or 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.data.codec.base64 :as base64]) | |
(defn str->base64 [^String in] | |
(-> in | |
(.getBytes UTF-8) | |
base64/encode | |
(String. UTF-8))) | |
(defn base64->str [^String in] | |
{:pre [in]} |
This file contains hidden or 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 page-offset | |
"Return [next-group, next-offset] in sequence | |
given offset of first item in required range. | |
group-fn should not return nil." | |
[group-fn offset items] | |
{:pre [(<= 0 offset)]} | |
;; (Do not force too much items from source sequence here) | |
(let [split-pos offset] | |
(when (seq (drop split-pos items)) | |
(->> (take (inc split-pos) items) |
This file contains hidden or 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
[package] | |
name = "rustlab" | |
version = "0.1.0" | |
authors = ["Petr Gladkikh <[email protected]>"] | |
[dependencies] | |
hyper = "0.9.11" | |
json = "*" |
This file contains hidden or 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 netty-lab.core | |
(require [clojure.data.json :as json]) | |
(:import (io.netty.bootstrap Bootstrap) | |
(io.netty.channel.socket.nio NioSocketChannel) | |
(io.netty.channel.socket SocketChannel) | |
(java.net URL URI) | |
(io.netty.channel.nio NioEventLoopGroup) | |
(io.netty.channel ChannelOption ChannelInitializer ChannelPipeline SimpleChannelInboundHandler ChannelHandlerContext ChannelHandler Channel) | |
(io.netty.handler.ssl SslContextBuilder SslContext) | |
(io.netty.handler.ssl.util InsecureTrustManagerFactory) |
This file contains hidden or 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 '[clj-http.client :as client] | |
'[clojure.java.io :as java.io] | |
'[clj-http.conn-mgr :as conn-mgr] | |
'[clojure.java.shell :as shell]) | |
(import org.apache.http.config.SocketConfig) | |
(import org.apache.http.config.ConnectionConfig) | |
(import java.io.InputStreamReader) | |
(import java.io.BufferedReader) | |
(def events-url "https://github.com") |
This file contains hidden or 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 client.nakadi.lab | |
(require [manifold.deferred :as d] | |
[manifold.stream :as s] | |
[aleph.http :as http] | |
[clojure.core.async :as a] | |
[byte-streams :as bs] | |
[clojure.java.shell :as shell]) | |
(:import (de.undercouch.actson JsonParser JsonEvent JsonFeeder) | |
(java.nio.charset StandardCharsets))) |
This file contains hidden or 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
[package] | |
name = "my-prompt" | |
version = "0.1.0" | |
authors = ["Petr Gladkikh <[email protected]>"] | |
[dependencies] | |
nix = "0.7.0" |