Skip to content

Instantly share code, notes, and snippets.

View windhooked's full-sized avatar

H windhooked

View GitHub Profile
@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"
@windhooked
windhooked / main.go
Created July 4, 2022 08:34 — forked from denisbrodbeck/main.go
How to generate secure random strings in golang with crypto/rand.
// License: MIT
package main
import (
"crypto/rand"
"fmt"
"math/big"
)
// GenerateRandomASCIIString returns a securely generated random ASCII string.

Run go install and

  • gogitlocalstats -add /path/to/folder will scan that folder and its subdirectories for repositories to scan
  • gogitlocalstats -email your@email.com will generate a CLI stats graph representing the last 6 months of activity for the passed email. You can configure the default in main.go, so you can run gogitlocalstats without parameters.

Being able to pass an email as param makes it possible to scan repos for collaborators activity as well.

License: CC BY-SA 4.0