Skip to content

Instantly share code, notes, and snippets.

@css459
css459 / arch-linux-devterm-a06.md
Created January 22, 2022 21:23
Installing Arch Linux on ClockworkPi DevTerm A06 (WIP)

Installing Arch Linux on ClockworkPi DevTerm A06

Cole Smith

January 22, 2022

Introduction

This document will walk you through installing Arch Linux ARM on the DevTerm A06. At the time of writing, only Armbian is supported on the DevTerm.

@cblavier
cblavier / app.js
Created January 9, 2021 10:55
Responsive Phoenix LiveView
const Hooks = { ViewportResizeHooks}
const connectLiveSocket = () => {
const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute('content')
const liveSocket = new LiveSocket('/my_app/live', Socket, {
params: {
_csrf_token: csrfToken,
viewport: {
width: window.innerWidth,
height: window.innerHeight
@RaimoNiskanen
RaimoNiskanen / code_lock.erl
Last active January 1, 2023 19:03
gen_statem Code Lock Example in Erlang for SF CodeBeam 2018
-module(code_lock).
-behaviour(gen_statem).
-define(NAME, code_lock).
-export([down/1,up/1,code_length/0]). % API
-export([start_link/1,stop/0]). % Server
-export([init/1,callback_mode/0,terminate/3]). % Behaviour
-export([locked/3,open/3]). % States
@eckyputrady
eckyputrady / Pseudo.hs
Last active April 2, 2023 12:07
Haskell Clean Architecture
-----------------------------
-- Domain.hs
type SessionId = Text
type UserId = Text
type User = Text
class (Monad m) => UserRepo m where
getUserById :: UserId -> m User
@jinleileiking
jinleileiking / grpc_middleware_logger.go
Created June 28, 2017 14:03
gpc + middleware + zap + log rotate
package main
import (
"fmt"
"log"
"net"
// "os"
// "path"
"os"
@voutilad
voutilad / vmm-alpine.sh
Created May 29, 2017 15:16
Installing Alpine Linux in OpenBSD's VMM Hypervisor
# Assuming you're a regular user that has doas allowances for vmctl
mkdir -p ~/vmm
cd ~/vmm
# Grab the the one of the virt iso's of Alpine Linux
curl https://nl.alpinelinux.org/alpine/v3.6/releases/x86_64/alpine-virt-3.6.0-x86_64.iso -o alpine-virt-3.6.0-x86_64.iso
# Make a new virtual disk image, change the size as needed
vmctl create alpine-virt.img -s 6G
@reyk
reyk / vmctl start ubuntu -d ubuntu-16.10-server-cloudimg-amd64.raw -n nat -c
Last active July 8, 2021 04:09
OpenBSD vmm and meta-data running ubuntu-16.10-server-cloudimg-amd64.raw
- Get OpenBSD from http://www.openbsd.org/ ;)
- Find an Ubuntu cloud image on https://cloud-images.ubuntu.com/
- Get https://github.com/reyk/meta-data and configure it for cloud-init
- Run the VM ...
Script started on Thu Mar 30 01:53:50 2017
# qemu-img convert ubuntu-16.10-server-cloudimg-amd64.img ubuntu-16.10-server-cloudimg-amd64.raw
# vmctl start ubuntu -d ubuntu-16.10-server-cloudimg-amd64.raw -n nat -c
Connected to /dev/ttyp6 (speed 9600)
Changing serial settings was 0/0 now 3/0
@tvlooy
tvlooy / vmm_howto.md
Last active February 28, 2024 15:14
OpenBSD VMM howto

OpenBSD VMM howto

Setup

/etc/rc.conf.local

apmd_flags="-A"
dhcpd_flags=vether0
vmd_flags=
ntpd_flags="-s"
@flbuddymooreiv
flbuddymooreiv / readme.md
Last active February 6, 2024 22:31
erlang + rebar + cowboy Hello World

This is the process of setting up erlang, rebar3, and cowboy for a Hello World, starting with a clean Debian 8 install.

Update apt and install deps:

root@046edcaea45a:~# apt-get update
root@046edcaea45a:~# apt-get install erlang erlang-dev gcc
root@046edcaea45a:~# wget https://s3.amazonaws.com/rebar3/rebar3
root@046edcaea45a:~# mkdir ~/bin/
root@046edcaea45a:~# mv rebar3 ~/bin/
root@046edcaea45a:~# chmod +x ~/bin/rebar3 
@remvee
remvee / time.cljs
Last active June 25, 2022 00:34
Calculate week number in clojurescript
(defn week-number
"Week number according to the ISO-8601 standard, weeks starting on
Monday. The first week of the year is the week that contains that
year's first Thursday (='First 4-day week'). The highest week number
in a year is either 52 or 53."
[ts]
(let [year (.getFullYear ts)
month (.getMonth ts)
date (.getDate ts)
day (.getDay ts)