Skip to content

Instantly share code, notes, and snippets.

View ceving's full-sized avatar
💭
Ejaculating

ceving

💭
Ejaculating
View GitHub Profile
@ceving
ceving / Go's embedding is no inheritance.md
Created November 5, 2023 21:58
Go's embedding is no inheritance

In a language with inheritance the following code would print "Child". But in Go the following prints "Parent".

package main

import (
    "fmt"
)

type Hello interface {
@ceving
ceving / Calling any function using reflect.md
Created October 29, 2023 08:20
Calling any function using reflect
package main

import (
	"fmt"
	"reflect"
)

var need_bool = func(b bool) { fmt.Printf("need_bool: %v", b) }
@ceving
ceving / Debug expressions in Scheme.md
Created July 14, 2023 11:55
Debug expressions in Scheme

Debug expressions in Scheme

The following can be used to inspect applications and values.

(define-syntax ?
  (syntax-rules ()
    ((_ (proc arg0 arg1 ...))
     (let* ((args (list arg0 arg1 ...))
	    (result (apply proc args)))
       (format (current-error-port)
 ";; (~s~{ ~s~}) => ~s\n"
@ceving
ceving / Essentielle_Aminosäuren.md
Last active July 11, 2023 18:39
Essentielle Aminosäuren
@ceving
ceving / Recompile VirtualBox kernel modules.md
Created July 6, 2023 09:43
Recompile VirtualBox kernel modules
/sbin/rcvboxadd quicksetup all
@ceving
ceving / Rsyslog-PGSQL.md
Last active July 5, 2023 17:13
Store Syslog in Postgresql

Store Syslog in Postgresql

The following describes how to configure Rsyslog to write all syslog messages into a Postgresql database.

This description requires at least Rsyslog 8.2302. If you are using Debian you need at least Debian 12 for this.

This setup uses UNIX domain socket authentiation. This has the advantage that the configuration files of Rsyslog do not contain any database password. It has the disadvantage, that the database must be running on the same system

@ceving
ceving / README.md
Created July 4, 2023 14:00
Migrate Postgresql 13 to 15

Migrate Postgresql 13 to 15

Check which cluster uses which port

# fuser -v /run/postgresql/.s.*
                     USER        PID ACCESS COMMAND
/run/postgresql/.s.PGSQL.5432:
                     postgres    653 F.... postgres
/run/postgresql/.s.PGSQL.5433:
 postgres 652 F.... postgres
@ceving
ceving / RX2NFA.scm
Last active February 26, 2023 13:04
Implementation of the presentation "Regex to NFA Conversion Isn't Hard! (Sipser 1.28a)" for Chez Scheme Version 9.5.4
;; Implementation of the presentation "Regex to NFA Conversion Isn't
;; Hard! (Sipser 1.28a)" available at https://youtu.be/VbR1mGdP99s for
;; Chez Scheme Version 9.5.4.
;;
;; Usage: scheme --script rx2nfa.scm | dot -Tsvg > nfa.svg
;; Functions lacking in R6RS.
(define (make-equal-hashtable)
(make-hashtable equal-hash equal?))
@ceving
ceving / touch.js
Last active February 12, 2023 13:10
Mixin message passing in JavaScript
function mapo (obj, proc)
{
return Object.fromEntries(Object.entries(obj).map(proc))
}
function mixin(mixture, condiment)
{
for (const name in condiment)
Object.defineProperty(mixture, name, condiment[name])
return mixture
@ceving
ceving / coerce_boolean_correctly.js
Created February 11, 2023 11:50
JavaScript Limerick: !!(new Boolean(false)) === true
function coerce_boolean_correctly (arg) {
if (arg instanceof Boolean)
return coerce_boolean_correctly(arg.valueOf())
return !!arg
}