Skip to content

Instantly share code, notes, and snippets.

@nikneroz
nikneroz / Guardian JWT.md
Last active October 10, 2023 19:13
Elixir + Phoenix Framework + Guardian + JWT. This is tutorial and step by step installation guide.

Elixir + Phoenix Framework + Guardian + JWT + Comeonin

Preparing environment

We need to generate secret key for development environment.

mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf

Let's generate User model and controller.

Problem

In Arch Linux mkinitcpio -p linux

shows

Possibly missing firmware for module: aic94xx
 Possibly missing firmware for module: wd719x
@tmepple
tmepple / goon.rb
Created June 9, 2017 15:09
Simple Homebrew Formula to compile and install Goon driver.
class Goon < Formula
desc "Goon Driver for Elixir Porcelain Library"
homepage "https://github.com/alco/goon"
url "https://github.com/alco/goon.git", :tag => "v1.1.1", :revision => "756deaad8465c4326841d8b8cbd194f724be6160"
head "https://github.com/alco/goon.git"
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
@adeluccar
adeluccar / gist:d105299f2d5af55e3e96f9b989e7eb48
Created August 8, 2017 22:50
How to Flatten the History of a Git Repository Safely
git checkout --orphan future-master
git add -A  # Add all files and commit them
git commit
git branch -D master  # Deletes the master branch
git branch -m master  # Rename the current branch to master
git push -f origin master  # Force push master branch to github
git gc --aggressive --prune=all     # remove the old files
@NoraCodes
NoraCodes / work_queue.rs
Last active May 5, 2025 11:02
An example of a parallel work scheduling system using only the Rust standard library
// Here is an extremely simple version of work scheduling for multiple
// processors.
//
// The Problem:
// We have a lot of numbers that need to be math'ed. Doing this on one
// CPU core is slow. We have 4 CPU cores. We would thus like to use those
// cores to do math, because it will be a little less slow (ideally
// 4 times faster actually).
//
// The Solution:
@rjz
rjz / crypto-aes-256-gcm-demo.js
Last active March 4, 2025 22:24
example using node.js crypto API with aes-256-gcm
const buffer = require('buffer');
const crypto = require('crypto');
// Demo implementation of using `aes-256-gcm` with node.js's `crypto` lib.
const aes256gcm = (key) => {
const ALGO = 'aes-256-gcm';
// encrypt returns base64-encoded ciphertext
const encrypt = (str) => {
// The `iv` for a given key must be globally unique to prevent
@kdwinter
kdwinter / Arch-ZFSRoot-on-dm-crypt-UEFI.md
Last active July 24, 2023 21:31 — forked from aaronlauterer/Arch-ZFSRoot-on-dm-crypt-UEFI
ZFSRoot installation over a dm-crypt volume for Arch Linux (UEFI)

Install Arch Linux on root ZFS filesystem

Pre-installation

Download Arch linux

https://archlinux.org

Create bootable USB (don't add partition number!)

@bbonamin
bbonamin / Brewfile
Last active November 25, 2024 15:47
Capybara Selenium Webdriver: Headless Chrome (with file downloads!) & Headless Firefox
tap "caskroom/cask"
cask "google-chrome"
cask "firefox"
brew "chromedriver"
brew "geckodriver"
@gmpreussner
gmpreussner / archlinux-install-nvme-luks-lvm-btrfs-usb
Last active March 23, 2023 09:31
Minimal instructions for installing a fully encrypted ArchLinux with USB boot on Lenovo Yoga 920.
# Install a fully encrypted ArchLinux on NVMe with detached LUKS
# headers and LUKS encrypted UEFI boot partition on a USB dongle.
#
# Full tutorial can be found here:
# https://headcrash.industries/reference/fully-encrypted-archlinux-with-secure-boot-on-yoga-920/
#
# Written by Gerke Max Preussner <[email protected]>
# Overview ############################################################
@whitequark
whitequark / README.txt
Last active October 6, 2022 22:44
Strava archiver
1. install postgres
2. run makedb.rb >tiles.csv
3. run tiles.sql
4. run archive.rb
5. enjoy