Skip to content

Instantly share code, notes, and snippets.

View fjsousa's full-sized avatar

Flávio Sousa fjsousa

View GitHub Profile
#!/usr/bin/env bash
set -euo pipefail
#Run with ./umbrel-fedora.sh --bootstrapped
# hardcoded settings to run on my Lenovo T440
#export DEBIAN_FRONTEND=noninteractive
needrestart_conf_dir="/etc/needrestart/conf.d"
needrestart_conf_file="${needrestart_conf_dir}/temp-disable-for-umbrel-install.conf"
sudo mkdir -p "${needrestart_conf_dir}"
(defn string->uuid
"deterministic ID
cljs version based on core/random-uuid with a few changes to use the seedrandom
WARNING: This is different than just adding a #uuid to a string"
[string]
#?(:clj (java.util.UUID/fromString (.toString (java.util.UUID/nameUUIDFromBytes (.getBytes string))))
:cljs (letfn [(random-fn [v] ((seedrandom (str string v))))
(det-rand-int [i n] (Math/floor (* (random-fn i) n)))
(hex [i] (.toString (det-rand-int i 16) 16))]
(defn full-outer-join
"merge two collections on key. Equivalent to SQL full outer join.
assumes keys are unique"
[k A B]
(let [A' (->> A
(group-by k)
(map (fn [[k v]] [k (first v)]))
(into {}))
B' (->> B
(group-by k)

Gi Escapes

Syllabus - need to hit these while rolling

Vol 2

  • [X] Bottom Mount ankle trap
  • [X] Bottom Mount Bridge escapes
  • [X] Bottom Mount knee escape
@fjsousa
fjsousa / mastering-emacs.md
Last active September 7, 2022 12:51
Mastering emacs shortcuts and important stuff
Verifying that +fsousa is my blockchain ID. https://onename.com/fsousa

Bitcoin

Cryptographic Hash Function

  • H: hash function (Sha-256)

  • M = H(message) fixed length digest or hash of the message

  • The size of the digest has a fixed length

  • Collision resistant: The probability of a conflicting digest value is very small

Rails App Deployment with the stack: Ubuntu + rbenv + nginx + unicorn. It's based on the article by Ariejan de Vroom blog and I've adapted it where needed.

##Assumptions

  • App: my_app
  • deploy_path: /home/minuscode/deploy
  • deployment user: minuscode

##Screen + SSH

First thing I like to do is to open up a screen session in the remote machine. The main commands you'll be needing are