Skip to content

Instantly share code, notes, and snippets.

View livingsilver94's full-sized avatar
๐Ÿƒ
Doing what I like

Fabio livingsilver94

๐Ÿƒ
Doing what I like
View GitHub Profile
@livingsilver94
livingsilver94 / mount_setaddr.go
Last active March 17, 2023 14:40
Demonstrate the usage of the mount_setaddr syscall to bind mount /sys in R/O mode
package main
import (
"log"
"os"
"path/filepath"
"golang.org/x/sys/unix"
)
@livingsilver94
livingsilver94 / .clang-format
Last active January 23, 2021 13:17
C/C++ clang-format
AccessModifierOffset: -2
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveMacros: true
AllowAllArgumentsOnNextLine: false
AllowShortCaseLabelsOnASingleLine: true
BasedOnStyle: Chromium
BinPackArguments: false
BinPackParameters: false
BreakConstructorInitializers: AfterColon
@livingsilver94
livingsilver94 / openwrt_image.md
Last active January 5, 2023 16:18
My OpenWrt image
  1. Go to the Firmware Selector and type in your model
  2. In Customize installed packages you can type in package you want already included in the final image.
  3. Finally, download the sysupgrade image

Here are my extra packages. Append them to the original package list:

luci luci-app-ddns luci-app-ksmbd luci-app-wifischedule luci-app-hd-idle stubby block-mount kmod-usb-storage kmod-usb-storage-uas kmod-fs-exfat kmod-usb2 kmod-usb3

@livingsilver94
livingsilver94 / same_ext.py
Last active October 31, 2019 13:53
Find files with same name but different extensions
#!/usr/bin/env python3
import argparse
import collections
import os
from os import path
ExtInfo = collections.namedtuple('ExtInfo', ['ext', 'path'])
arg_parser = argparse.ArgumentParser(description='Find results with same name but different extension.')
@livingsilver94
livingsilver94 / urltrie.js
Created August 9, 2019 20:55
A trie that can generate a regex to match the URL represented by its contents.
/*
MIT License
Copyright (c) 2019 Fabio Forni
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@livingsilver94
livingsilver94 / zsh_notifications.zsh
Last active November 19, 2019 14:22 — forked from jpouellet/zbell.sh
Make Zsh show a notification when long-running commands finish. The notification will show useful information such as the exit status and what command terminated.
# Make Zsh show a notification when long-running commands finish.
# You can tweak some parameters by editing the according variable.
#
# Written by Jean-Philippe Ouellet <jpo@vt.edu>
# Made available under the ISC license.
# Edited by Fabio Forni.
[[ -o interactive ]] || return
zmodload zsh/datetime || return
autoload -Uz add-zsh-hook || return
@livingsilver94
livingsilver94 / trie.js
Last active August 9, 2019 20:56
JavaScript Trie implementation (ES2015+).
/*
MIT License
Copyright (c) 2019 Fabio Forni
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is