Skip to content

Instantly share code, notes, and snippets.

@mreishus
mreishus / app.js
Last active September 13, 2019 04:52
First try at Phoenix LiveView Hook organization
// assets/js/app.js
// We need to import the CSS so that webpack will load it.
// The MiniCssExtractPlugin is used to separate it out into
// its own CSS file.
import css from "../css/app.css"
// webpack automatically bundles all modules in your
// entry points. Those entry points can be configured
// in "webpack.config.js".
@mreishus
mreishus / create_post.exs
Created September 12, 2019 01:48 — forked from stevedomin/create_post.exs
Using UUIDs as primary key with Ecto
defmodule MyBlog.Repo.Migrations.CreatePost do
use Ecto.Migration
def change do
create table(:posts, primary_key: false) do
add :id, :uuid, primary_key: true
add :body, :string
add :word_count, :integer
timestamps
@mreishus
mreishus / .gitlab-ci.yml
Created August 19, 2019 17:05
gitlab-ci.yml for self-signed docker repositories, from debuglevel/greeting-microservice
services:
- name: docker:dind
command: ["/bin/sh", "-c", "[[ -z $CERTIFICATE_URL ]] && ( echo Injecting no certificate && dockerd-entrypoint.sh || exit ) || ( echo Injecting certificate $CERTIFICATE_URL && wget $CERTIFICATE_URL -O /usr/local/share/ca-certificates/cert.crt && update-ca-certificates && dockerd-entrypoint.sh || exit )"]
variables:
## Uncomment this to inject a self-signed certificate into the docker:dind service
# CERTIFICATE_URL: http://my_server/my_corp.crt
# # disable TLS; see: https://gitlab.com/gitlab-org/gitlab-runner/issues/1350#note_199840999 and https://about.gitlab.com/2019/07/31/docker-in-docker-with-docker-19-dot-03/
# DOCKER_TLS_CERTDIR: ""
@nathanl
nathanl / jeg_stateful_web_applications.md
Last active October 31, 2019 16:48
James Edward Gray II describing the ability to build *stateful* web application in Elixir

James Edward Gray II

Quote from Elixir Mix 63 - "063: Designing Elixir Systems With OTP with Bruce Tate and James Gray", starting at 01:03:13

"I've worked at a bunch of companies building web apps for a long time, and I keep seeing this same pattern, and it haunts me. In the web world, all we want is these long interactions with people, and we live in this stateless world. So what we do is, the first part of every request, we do thirty queries to re-establish the state of the world that we just forgot a few seconds ago after the last request. And then we go forward and make one tiny step forward, and then we forget everything again, so that when the next request comes in we can do thirty queries to put it all back and make one more tiny step. And I kept thinking, "there has to be a better way than this, right?"

And if you look at web advancements over the years, most of the things we're doing are

@huntrar
huntrar / full-disk-encryption-arch-uefi.md
Last active July 13, 2024 08:35
Arch Linux Full-Disk Encryption Installation Guide [Encrypted Boot, UEFI, NVMe, Evil Maid]

Arch Linux Full-Disk Encryption Installation Guide

This guide provides instructions for an Arch Linux installation featuring full-disk encryption via LVM on LUKS and an encrypted boot partition (GRUB) for UEFI systems.

Following the main installation are further instructions to harden against Evil Maid attacks via UEFI Secure Boot custom key enrollment and self-signed kernel and bootloader.

Preface

You will find most of this information pulled from the Arch Wiki and other resources linked thereof.

Note: The system was installed on an NVMe SSD, substitute /dev/nvme0nX with /dev/sdX or your device as needed.

@anthonyclarka2
anthonyclarka2 / borg-backup-enhanced.sh
Created August 14, 2017 17:06
Borg backup script with exit code checking and status push to Zabbix
#!/bin/sh
# Enhanced backup script
# Sends messages to Zabbix based on exit code of borg executable
#
# anthonyclark AT G MAIL
# Shellcheck will still kvetch at you if notices are enabled
#
# This script will not work AS-IS but is only provided as such
# NO WARRANTIES
# This work is licensed under a Creative Commons Attribution 4.0 International License.
@OdinsPlasmaRifle
OdinsPlasmaRifle / arch_linux_installation.md
Last active July 14, 2024 19:55
LVM on LUKS Arch installation with systemd-boot
@tkh44
tkh44 / Animation.jsx
Last active September 13, 2022 01:31
react-router v4 animated with data-driven-motion
import React from 'react'
import { BrowserRouter as Router, Route, Link, Redirect, matchPath } from 'react-router-dom'
import { Motion } from 'data-driven-motion' // https://github.com/tkh44/data-driven-motion
const WOBBLY_SPRING = { stiffness: 200, damping: 15, precision: 0.1 }
const AnimationExample = () => (
<Router>
<div>
<ul>
@heppu
heppu / ARCH_INSTALL.MD
Last active February 27, 2022 17:01
Installing Arch with GPT, dm-crypt, LUKS, LVM and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync

Boot from USB and set prepare system

loadkeys <your-keymap>
@stevedomin
stevedomin / create_post.exs
Last active July 6, 2024 17:22
Using UUIDs as primary key with Ecto
defmodule MyBlog.Repo.Migrations.CreatePost do
use Ecto.Migration
def change do
create table(:posts, primary_key: false) do
add :id, :uuid, primary_key: true
add :body, :string
add :word_count, :integer
timestamps