Skip to content

Instantly share code, notes, and snippets.

@alxbnct
alxbnct / unbond.conf
Created August 20, 2022 14:37 — forked from MatthewVance/unbond.conf
Example of how to configure Unbound as a local forwarder using DNS-over-TLS to forward queries.
server:
###########################################################################
# BASIC SETTINGS
###########################################################################
# Time to live maximum for RRsets and messages in the cache. If the maximum
# kicks in, responses to clients still get decrementing TTLs based on the
# original (larger) values. When the internal TTL expires, the cache item
# has expired. Can be set lower to force the resolver to query for data
# often, and not trust (very large) TTL values.
cache-max-ttl: 86400
@alxbnct
alxbnct / print-variables-in-scheme-using-macro.md
Last active May 27, 2022 02:46
Macro for printing variables in scheme

Very often we want to debug a program by printing variables, the following macro makes it easier and more convenient.

(define-syntax dbg
  (syntax-rules ()
    ((_ fst ...)
     (begin (let loop ((lst (list fst ...))
                       (symbol-names (map symbol->string (quote (fst ...)))))
              (if (not (null? lst))
                  (begin (display (string-append " " (car symbol-names) ": "))
                         (display (car lst))
@kasramp
kasramp / host_vbox_custom_resolution.sh
Last active September 1, 2022 12:59
Set screen resolution on Virtualbox (host machine)
#!/bin/sh
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Pass VBox machine name and screen resolution"
echo "Example: 'OpenBSD New' '1920x1080x32'"
exit 1
fi
VBoxManage setextradata "$1" CustomVideoMode1 "$2"
@kasramp
kasramp / openbsd_vbox_resolution.sh
Last active September 1, 2022 12:59
Set OpenBSD screen resolution on Virtualbox
#!/bin/sh
# inspired by https://www.tumfatig.net/20190131/customized-resolution-for-openbsd-in-virtualbox/
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
mkdir -p /etc/X11/xorg.conf.d
@vegard
vegard / kernel-dev.md
Last active May 6, 2024 08:55
Getting started with Linux kernel development

Getting started with Linux kernel development

Prerequisites

The Linux kernel is written in C, so you should have at least a basic understanding of C before diving into kernel work. You don't need expert level C knowledge, since you can always pick some things up underway, but it certainly helps to know the language and to have written some userspace C programs already.

It will also help to be a Linux user. If you have never used Linux before, it's probably a good idea to download a distro and get comfortable with it before you start doing kernel work.

Lastly, knowing git is not actually required, but can really help you (since you can dig through changelogs and search for information you'll need). At a minimum you should probably be able to clone the git repository to a local directory.

@Anime4000
Anime4000 / readme.md
Last active April 29, 2024 07:41
Linux Mail Server Postfix Dovecot Virtual User, no sql database

Linux Mail Server

In this guide, I will show you how to make a Linux Mail Server in fast and easy way. This guide was taken from tiq's tech-blog for recent version, Linux distro I using is Ubuntu 20.04 LTS

Certificate

Make sure you have Certificate and Key file ready to use.

You can use existing Web Server SSL certificate, since we going to use same domain, example.com.

If you plan to use mx.example.com or mail.example.com you need create another one for these.

@gdamjan
gdamjan / README.md
Last active March 23, 2024 15:58
libvirt with ipvtap over wifi

ipvtap over wifi for libvirt

ipvtap is similar to macvtap, but works over wifi too, since it uses the same mac address as the wifi interface.

libvirt doesn't support ipvtap, so we have to configure everything manually. Important data we need before we start:

  • the name of the wifi interface, wlan0 in my case (it's already connected - use NM or networkd+iwd).
  • the mac address of the wifi interface (it must be the same in the guest too)

On the host:

@juancarlospaco
juancarlospaco / printf.nim
Last active December 30, 2023 07:00
C print for Nim
proc printf*(format: cstring): cint {.importc, header: "<stdio.h>".}
proc fprintf*(stream: File, format: cstring): cint {.importc, header: "<stdio.h>".}
proc sprintf*(str: var cstring, format: cstring): cint {.importc, header: "<stdio.h>".}
proc vsprintf*(str: var cstring, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
proc vfprintf*(stream: File, format: cstring, arg: varargs[typed, `$`]): cint {.importc, header: "<stdio.h>".}
@jjwatt
jjwatt / yplay.scm
Last active March 14, 2023 04:09
The Y Combinator explained in a runnable Scheme file
;;; The Y Combinator explained in scheme.
;;; with credits to:
;;; https://mvanier.livejournal.com/2897.html
;;; Status: WIP
(define fibonacci
(lambda (n)
(cond ((= n 0) 0)
((= n 1) 1)
(else (+ (fibonacci (- n 1)) (fibonacci (- n 2)))))))
@krisleech
krisleech / renew-gpgkey.md
Last active May 5, 2024 10:26
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date: