Skip to content

Instantly share code, notes, and snippets.

View henkman's full-sized avatar
🌶️

henkman henkman

🌶️
View GitHub Profile
package main
import (
"image"
"image/color"
"image/draw"
"image/png"
"math"
"os"
)
@henkman
henkman / Dockerfile
Created August 5, 2021 11:25
go+docker
FROM golang:1.16.6-alpine
WORKDIR /go/src/app
COPY main.go go.mod /go/src/app/
RUN go build
FROM alpine:latest
EXPOSE 8080
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=0 /go/src/app/app ./
@henkman
henkman / chromium.reg
Last active March 31, 2020 09:04
Regsitry keys to set chromium as default app
Windows Registry Editor Version 5.00
; TODO before adding to registry : Replace C:\\Program Files\\chrome\\bin\\chrome.exe with the path to your chromium exe
; double \ in the path
; after double click on reg file for adding to registry
; after : go into windows default program parameters and set Chromimum as default
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"Chromium"="Software\\Clients\\StartMenuInternet\\Chromium\\Capabilities"
@henkman
henkman / app.go
Last active October 20, 2020 16:42
webapp example with fiber + jwt-go +gorm + scrypt
package main
import (
"bytes"
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"fmt"
"io"
"regexp"
INDUSTRIAL SOCIETY AND ITS FUTURE
Introduction
1. The Industrial Revolution and its consequences have been a disaster for the
human race. They have greatly increased the life-expectancy of those of us
who live in “advanced” countries, but they have destabilized society, have
made life unfulfilling, have subjected human beings to indignities, have led
to widespread psychological suffering (in the Third World to physical
suffering as well) and have inflicted severe damage on the natural world. The
-s -O2 -fno-ident -ffunction-sections -Wl,--gc-sections -fno-stack-protector -fno-stack-check -s
-flto -s -O2 -fno-ident -ffunction-sections -Wl,--gc-sections -fno-stack-protector -fno-stack-check -s
https://github.com/svaarala/duktape/blob/master/doc/low-memory.rst#optimizing-code-footprint
@henkman
henkman / md_to_pdf.go
Last active October 11, 2018 13:26
markdown to pdf converter
package main
import (
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"github.com/jung-kurt/gofpdf"
@henkman
henkman / wpset.c
Last active September 9, 2020 21:44
set wallpaper util
#include <stdio.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef enum
{
Tile,
Center,
Stretch,
Fit,
Fill
@henkman
henkman / buffer.h
Last active June 10, 2018 12:53
single header C api for http request
typedef struct
{
size_t size, cap;
char *data;
} Buffer;
static size_t next_power_of_two(size_t v)
{
v--;
@henkman
henkman / cam.h
Created May 29, 2018 15:12
single header C api for webcam frame capture
/*
// gcc -s -O3 -std=c99 -Wall -o cam cam.c -lvfw32
#include <stdio.h>
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#include "cam.h"
int main(void)
{
long w = 1280;