Skip to content

Instantly share code, notes, and snippets.

View davidroman0O's full-sized avatar
🏠
Working from home

David Roman davidroman0O

🏠
Working from home
  • Ubisoft
  • Montréal, Canada
View GitHub Profile
@odnanref
odnanref / pihole.nomad
Created February 12, 2022 10:55
PiHole LoadBalance UDP and HTTP
job "pihole" {
datacenters = ["dc1"]
type = "service"
group "pihole" {
count = 1
volume "volume_nomad" {
type = "host"
read_only = false
@boofexxx
boofexxx / guessing_game.zig
Last active June 12, 2022 18:59
guessing game zig
const std = @import("std");
const print = std.debug.print;
pub fn main() anyerror!void {
print("Guess the number!\n", .{});
var secretNumber: i32 = std.rand.DefaultPrng
.init(@intCast(u64, std.time.timestamp()))
.random().intRangeAtMost(i32, 0, 100);
print("The secret number is {}\n", .{secretNumber});

NixOS NAS drives setup

My guide for setup of NixOS with LVM on multiple device LUKS on mdadm:

  1. mdadm for RAID 1:

    • for system and data physical volumes,
    • you can use RAID5 or other levels, based on needs,
  2. LUKS for device encryption:

// Another suggestion from watching
// https://www.youtube.com/watch?v=AHc4x1uXBQE&t=336s
// with my (genuine) 1 hour zig coding experience, I naively believe
// that this sould remove the memory issue within the union.
// and therefore is a slight improvement on the presented enum solution
const std = @import("std");
const stdout = std.io.getStdOut().writer();
@royalgarter
royalgarter / oneliner.sh
Created October 16, 2021 05:26
Oneliners shellscript
System information commands
===========================
(*) #su Show only errors and warnings: `dmesg --level=err,warn`
(*) View dmesg output in human readable format: `dmesg -T`
(*) Get an audio notification if a new device is attached to your computer: `dmesg -tW -l notice | gawk '{ if ($4 == "Attached") { system("echo New device attached | espeak") } }`
(*) Dmesg: follow/wait for new kernel messages: `dmesg -w`
(*) The proper way to read kernel messages in realtime.: `dmesg -wx`
(*) Query graphics card: `lspci -nnk | grep -i VGA -A2`
@shqld
shqld / css-size-comparison.csv
Last active October 3, 2022 21:13 — forked from primaryobjects/css-comparison.csv
A comparison of CSS library sizes.
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
Caution,Name,Version,Size (raw),Size (minified),Size (gzipped),"Site","URL",Remarks
,Milligram,v1.4.1,11 kb,9.0 kb,2.3 kb,"https://milligram.io/","https://cdnjs.cloudflare.com/ajax/libs/milligram/1.4.1/milligram.min.css",
,Skelton,v2.0.4,11 kb,5.8 kb,1.6 kb,"http://getskeleton.com/","https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css",
,Material Design Lite,v1.3.0,146 kb,62 kb,12 kb,"https://getmdl.io/","https://code.getmdl.io/1.3.0/material.min.js",
,Foundation,v6.6.3,168 kb,133 kb,17 kb,"https://get.foundation/","https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/css/foundation.min.css",
,Materialize,v1.0.0,179 kb,141 kb,21 kb,"https://materializecss.com/","https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css",
,Bootstrap,v4.6.0,199 kb,161 kb,24 kb,"https://getbootstrap.com/docs/4.6/","https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css",
,Bootstrap,v5.1.2,206 kb,164 kb,24 kb,"https://getbootstrap.com/","https://cdn.jsdelivr.net/npm/b
@munrocket
munrocket / wgsl_2d_sdf.md
Last active June 4, 2024 09:46
WGSL 2D SDF Primitives

WGSL 2D SDF Primitives

Revision: 06.08.2023, https://compute.toys/view/398

Circle - exact

fn sdCircle(p: vec2f, r: f32) -> f32 {
  return length(p) - r;
}
const std = @import("std");
const builtin = @import("builtin");
const testing = std.testing;
const process = std.process;
const fs = std.fs;
const ChildProcess = std.ChildProcess;
var a: *std.mem.Allocator = undefined;
pub fn main() !void {
@gabihodoroaga
gabihodoroaga / graph.go
Last active March 21, 2024 12:08
Simple app to test the graph shortest path for gonum and yourbasic/graph
package main
import (
"gonum.org/v1/gonum/graph"
"gonum.org/v1/gonum/graph/simple"
"gonum.org/v1/gonum/graph/traverse"
)
var (
wdg *LightWeightedGraph
/*
* Build with:
* g++ aaraymarcher.cpp $(aalib-config --cflags) $(aalib-config --libs) -lm -o aaraymarcher
*/
#include <math.h>
#include <unistd.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>