Skip to content

Instantly share code, notes, and snippets.

@russmack
russmack / install-arch-linux-lvm-luks-dell-xps-13.md
Created November 24, 2020 14:50 — forked from chrisleekr/install-arch-linux-lvm-luks-dell-xps-15-7590.md
Install Arch Linux with Full Disk Encryption (LVM on LUKS) for Dell XPS 13/15
@russmack
russmack / read_write_fifo_erlang.md
Created July 31, 2018 23:51 — forked from jaredmorrow/read_write_fifo_erlang.md
Reading and Writing to Fifo (named pipes) in Erlang

Erlang and Named Pipes

The intention of this post is to provide a solution (with examples) to a somewhat uncommon issue in Erlang. I hate searching for answers to the same problems over and over, and I had a hard time finding answers to this particular problem, so I wrote it all down once I figured it out. If one day you decide to read and write data through fifo's (named pipes) and then decide you want to read or write the other end of the pipe from Erlang, this post is for you.

The Problem

I wanted to read and write to a fifo from a C/C++ app and have an Erlang app communicate over the other end of that fifo. Put simply, Erlang doesn't really support what I was trying to do. You cannot just file:open/2 a fifo, or any special device for that matter, in Erlang and expect it to work. This is documented in Erlang's FAQ.

The Solution! ... ???

@russmack
russmack / kiss3dpoints-src-main.rs
Created July 21, 2018 16:39
This demonstrates the difference in point rendering between Kiss3d v0.13.0 and v0.14.0
extern crate glfw;
extern crate kiss3d;
extern crate nalgebra as na;
use na::Point3;
use kiss3d::window::Window;
use kiss3d::light::Light;
/*
Good Cargo.toml
package main
import (
"fmt"
)
func fn(m map[int]int) {
m = map[int]int{42: 101}
}
@russmack
russmack / bit-editing.go
Created June 23, 2015 19:23
Editing bits.
package main
import (
"fmt"
"math/big"
)
/*
1
10
@russmack
russmack / int-to-uint8-rudimentary.go
Last active August 29, 2015 14:23
A quick and simple way to convert int to uint8.
package main
import (
"fmt"
)
func main() {
var x int = 217
var y uint8
for i := 0; i < x; i++ {
// Author: Kyle Lemons
package main
import (
"fmt"
"http"
"log"
)
func Log(handler http.Handler) http.Handler {
@russmack
russmack / golang-timing-functions-francesc-2
Created May 26, 2015 11:17
Time Golang functions in a single line of code with logger.
// Author: @francesc
package main
import (
"log"
"time"
)
type Logger struct {
Log func(format string, args ...interface{})
@russmack
russmack / golang-timing-functions-francesc
Created May 25, 2015 16:51
Time Golang functions in a single line of code.
// Author: @francesc
package main
import (
"log"
"time"
)
func whenDone() func(format string, args ...interface{}) {
start := time.Now()