Skip to content

Instantly share code, notes, and snippets.

@capocasa
capocasa / BS170.mod
Last active April 28, 2024 19:48
spice output
*BS170/MMBF170 at Temp. Electrical Model
*-----------------------------------------
.SUBCKT BS/MMBF170 20 10 30 50
*20=DRAIN 10=GATE 30=SOURCE 50=VTEMP
Rg 10 11x 1
Rdu 12x 1 1u
M1 2 1 4x 4x DMOS L=1u W=1u
.MODEL DMOS NMOS(VTO=2.9 KP=8.2E-1
+THETA=0.05 VMAX=0.8E5 LEVEL=3)
Cgs 1 5x 27p
@capocasa
capocasa / postgres-database-setup
Last active January 1, 2024 12:36
Triple-Redundant Hetzner Debian postgres setup
##### This is how to set up a triple redundant postgres.
##### Use a main box on Hetzner, a secondary small box on Hetzner in a
##### different datacenter for query replication, and a Hetzner Storage-Box
##### for file replication.
##### There will always be two copies of the data in different datacenters by the time
##### the transaction completes.
##### Here, Wireguard is used to have an internal network between the two hosts,
##### but Hetzner networks could also be used. SSH access between the two boxes
@capocasa
capocasa / nimeric.nim
Last active May 31, 2023 11:54
NimEric German Tax Upload
## Nimeric
##
## This is a proof-of-concept to link to the official german tax upload, that is
## distributed as a proprietary cross platform C library with headers called "eric".
##
## Obtaining these files requires a free developer account at elster.de developer area.
## To actually use them, a vendor ID needs to be applied for on the same site.
##
## This requires placing the libericapi.so and other library files "liberic/lib" sub-directory, and placing
## the headers in the liberic/headers sub-directory.
#!/bin/bash
### configuration section
BOUNCE_EXIT_CODE=72
RUN_SECONDS=4
LOCK_FILE_DIRECTORY="/dev/shm"
###
set -o errexit
@capocasa
capocasa / gist:6c1073b2d8f2c078f62b7341517d55a9
Created January 6, 2020 07:24
Dirty bash script to hardlink photos based on exif4
#!/bin/bash
V=true
SCRIPT=$(basename $0)
SRC="/srv/beatrice/iphone11 /srv/beatrice/iPhoneCamera /srv/syncthing/Beatrice_Pictures /srv/syncthing/Camera"
DEST=/srv/sigal/src
find $SRC -type f | while read FILE; do
KEY=$(echo "$FILE" | base32 -w0)
./ccminer ccminer -a sha256d -o stratum+tcp://195.201.119.226:3333 -u ccminercloudtest -p x
[2018-04-17 19:33:16] sha256d block 301227, diff 1.000
[2018-04-17 19:33:21] GPU #0: Quadro P4000, 809.39 MH/s
[2018-04-17 19:33:27] GPU #0: Quadro P4000, 824.84 MH/s
[2018-04-17 19:33:32] GPU #0: Quadro P4000, 809.93 MH/s
[2018-04-17 19:33:37] GPU #0: Quadro P4000, 814.78 MH/s
[2018-04-17 19:33:42] GPU #0: Quadro P4000, 810.12 MH/s
[2018-04-17 19:33:48] GPU #0: Quadro P4000, 812.24 MH/s
[2018-04-17 19:33:53] GPU #0: Quadro P4000, 810.17 MH/s
[2018-04-17 19:33:58] GPU #0: Quadro P4000, 810.15 MH/s
diff --git a/platform/x11/x11_main.c b/platform/x11/x11_main.c
index 21e3e84..3bce5aa 100644
--- a/platform/x11/x11_main.c
+++ b/platform/x11/x11_main.c
@@ -96,6 +96,8 @@ static char copyutf8[1024 * 48] = "";
static Time copytime;
static char *filename;
static char message[1024] = "";
+static char *shadecolor = 0;
+static char *papercolor = 0;
@capocasa
capocasa / Makefile
Last active March 7, 2018 21:12
nim host and guest
all: host plugin.cpp.so plugin.nim.so
host: host.cpp
g++ host.cpp -ldl -o host
plugin.cpp.so: plugin.cpp
g++ -fpic -c plugin.cpp -o plugin.o
g++ -shared -o plugin.cpp.so plugin.o
echo "
import system
type Bar[T] = ref object
value: T
type types = int32|int64 # if I change this to just int32 or int64 it works (compiles)
# if I replace Bar everywhere with seq it also compiles fine
Delivered-To: [email protected]
Received: by 10.176.83.135 with SMTP id k7csp6194507uaa;
Wed, 28 Feb 2018 06:04:22 -0800 (PST)
X-Received: by 10.31.165.213 with SMTP id o204mr13126704vke.163.1519826662835;
Wed, 28 Feb 2018 06:04:22 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1519826662; cv=none;
d=google.com; s=arc-20160816;
b=xhPvx2TbOalBWNf4Fq5UrTtZ3HTxRnAIku+rO3aQeb212RmNTqxfZ4Hy4GjhUeachT
iYKnIssEu1KKXTd7D4w1Q1RTruNFlIHZoTamUwu/uwcIogjTgsotOwHWTzh7+muD6CkI
GHe1SibtJCmRdzk/ubQgJjcTS4SxNllk23Ly3UDSferDK0OhUbIYQ4d9ubbDt2k+xet9