Skip to content

Instantly share code, notes, and snippets.

View windhooked's full-sized avatar

H windhooked

View GitHub Profile
@windhooked
windhooked / makecert.sh
Created August 22, 2025 09:42 — forked from jim3ma/makecert.sh
Golang TLS server and client
#!/bin/bash
# call this script with an email address (valid or not).
# like:
# ./makecert.sh [email protected]
mkdir certs
rm certs/*
echo "make server cert"
openssl req -new -nodes -x509 -out certs/server.pem -keyout certs/server.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=www.random.com/emailAddress=$1"
echo "make client cert"
openssl req -new -nodes -x509 -out certs/client.pem -keyout certs/client.key -days 3650 -subj "/C=DE/ST=NRW/L=Earth/O=Random Company/OU=IT/CN=www.random.com/emailAddress=$1"
package main
import (
"crypto/ecdh"
"crypto/rand"
"crypto/sha256"
"fmt"
"io"
"os"
@windhooked
windhooked / active-window.go
Created March 14, 2024 10:32 — forked from obonyojimmy/active-window.go
Go lang get current foreground window
package main
import (
"fmt"
"syscall"
"unsafe"
"golang.org/x/sys/windows"
)
var (
@windhooked
windhooked / main.go
Created March 9, 2024 04:23 — forked from alex-leonhardt/main.go
golang text/template with a map[string]interface{} populated from mixed json data
package main
import (
"encoding/json"
"os"
"reflect"
"text/template"
)
@windhooked
windhooked / accounting.sql
Created October 21, 2023 04:04 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@windhooked
windhooked / accounting.sql
Created October 21, 2023 04:03 — forked from ak4zh/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE account_groups
(
id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ),
name text COLLATE pg_catalog."default" NOT NULL,
account_group_id bigint,
CONSTRAINT account_types_pkey PRIMARY KEY (id),
CONSTRAINT account_groups_account_group_id_fkey FOREIGN KEY (account_group_id)
REFERENCES public.account_groups (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
@windhooked
windhooked / migration.sql
Created October 21, 2023 04:03 — forked from ak4zh/migration.sql
Double Entry Book Keeping with Journals and Voucher
CREATE TABLE public.vouchers (
id serial PRIMARY KEY,
name text NOT NULL
);
INSERT INTO vouchers
(name)
VALUES
('Sales'),
('Purchase'),
package pocketbase
import (
"errors"
"fmt"
"time"
"github.com/duke-git/lancet/v2/convertor"
"github.com/go-resty/resty/v2"
"golang.org/x/sync/singleflight"
@windhooked
windhooked / vga.dts
Created June 25, 2023 07:17 — forked from artizirk/vga.dts
Cubietruck Allwinner A20 VGA output on mainline Armbian
/dts-v1/;
/plugin/;
/* Based on https://github.com/wens/linux/commits/sun4i-drm-tve-vga-wip */
/* Tested with Cubetruck */
/* save it somewhere and run sudo armbian-add-overlay vga.dts */
/ {
compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun8i-h3", "allwinner,sun50i-a64", "allwinner,sun50i-h5";
@windhooked
windhooked / gotk-glade-test.go
Created June 16, 2023 07:46 — forked from Northern-Lights/gotk-glade-test.go
How to use Glade UI builder in a Go/golang GTK application using gotk
package main
import (
"fmt"
"log"
"os"
"reflect"
"github.com/gotk3/gotk3/glib"