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
import XMonad (def, modMask, mod4Mask, xK_q, xK_w, xK_e, xK_a, xK_s, xK_d, borderWidth, layoutHook) | |
import XMonad.Main (xmonad) | |
import XMonad.Layout.Grid | |
import XMonad.Util.EZConfig (additionalKeys) | |
import XMonad.Util.PureX (defile, greedyView) | |
-- https://hoogle.haskell.org/ | |
winKey = mod4Mask |
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 '[spire.module.shell :refer [shell]]) | |
;; >>= :: m a -> (a -> m b) -> m b | |
(defn >>= [{:keys [result out-lines] :as prev} f] | |
(if (= result :ok) | |
(f out-lines) | |
prev)) | |
;; return :: a -> m a | |
(defn return [cmd] |
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.java.io :as io]) | |
(defmacro with-file | |
"bindings => [name init ...] | |
Evaluates body in a try expression with names bound to the values | |
of the inits, and a finally clause that calls (io/delete-file name) on each | |
name in reverse order." | |
[bindings & body] | |
(#'clojure.core/assert-args | |
(vector? bindings) "a vector for its binding" |
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 all-settled [promises] | |
(js/Promise. | |
(fn [resFn _] | |
(let [state (atom {:resolutions (vec (repeat (count promises) nil)) | |
:counter 0}) | |
process (fn [idx type] | |
(fn [val] | |
(swap! state | |
(fn [{:keys [resolutions counter]}] | |
{:resolutions (assoc resolutions idx |
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 get-file-splits | |
[size-in-bytes mb-per-split] | |
(let [num-parts (Math/ceil (/ size-in-bytes mb-per-split))] | |
(map | |
(fn [part-num] | |
{::part-number (inc part-num) | |
::start-pos (if (zero? part-num) | |
0 | |
(inc (* part-num mb-per-split))) | |
::max-bytes-to-transfer mb-per-split}) |
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 get-file-splits | |
[size-in-bytes mb-per-split] | |
(let [num-parts (Math/ceil (/ size-in-bytes mb-per-split))] | |
(map | |
(fn [part-num] | |
{::part-number (inc part-num) | |
::start-pos (if (zero? part-num) | |
0 | |
(inc (* part-num mb-per-split))) | |
::max-bytes-to-transfer mb-per-split}) |
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
Order | |
Fetching | |
fetched -> List | |
fetching-error -> List | |
List | |
resend-confirmation -> ResendingConfirmation | |
download -> Downloading | |
refund -> ConfirmRefund | |
ResendingConfirmation | |
resend-confirmation -> ResendConfirmationSuccess |
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
FTPs | |
Fetching | |
fetch-success -> List | |
fetch-failure -> List | |
# Only state where main layout controls are enabled | |
List | |
new-ftp -> Creating FTP | |
delete-ftp -> Sure delete FTP | |
test-ftp -> Sure test FTP | |
Creating FTP |
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
#!/usr/bin/env bb | |
;; Run it using [babashka](https://github.com/borkdude/babashka) | |
;; > bb -f tag-buckets.clj | |
;; Related info: https://stackoverflow.com/questions/52645443/how-to-add-tags-to-an-s3-bucket-without-deleting-the-existing-tags-using-boto3 | |
(defn parse [str] | |
(json/parse-string str true)) | |
(defn print [data] |
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
set noautofocus | |
map m* setMark | |
map <A-p> pinTab | |
map <C-h> previousTab | |
map <C-l> nextTab | |
map <C-j> scrollFullPageDown | |
map <C-k> scrollFullPageUp | |
map $ lastTab | |
" Open new tab with current URL | |
map T :tabnew @%<CR> |
NewerOlder