Skip to content

Instantly share code, notes, and snippets.

@bokunodev
bokunodev / go.mod
Created January 22, 2022 14:32
example cookie on differ ports
module local.pc/sand
go 1.18
require github.com/go-chi/chi/v5 v5.0.7
require github.com/davecgh/go-spew v1.1.1
@bokunodev
bokunodev / table.c
Last active June 14, 2021 21:26
Hash Table in C11
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "table.h"
#define NORMALIZE(HASH) (HASH % table->len) - 1
static uint64_t fnv1a(const char* data, size_t len);
@bokunodev
bokunodev / print.c
Created June 14, 2021 16:39
Print decimal binary in C
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
void print_dec_bin(uint64_t d);
int main(int argc, char const *argv[]) {
print_dec_bin(0);
print_dec_bin(1);
print_dec_bin(7);
@bokunodev
bokunodev / Makefile
Last active May 19, 2021 06:32
Print 2D matrix
CC?=gcc
DEFAULT_CFLAGS=-std=c11 -Og -Wall -Wextra -Wshadow
define GCC_FLAGS
-Wanalyzer-file-leak \
-Wanalyzer-malloc-leak \
-Wanalyzer-double-free \
-Wanalyzer-double-fclose \
-Wanalyzer-null-argument \
@bokunodev
bokunodev / init.lua
Last active May 14, 2021 15:22
my textadept init file
_M["go"] = require("go")
_M["go"].format_command = "goimports"
_M["m/f"] = require("functions")
keys["`"] = function() _M["m/f"].enclose_selection("`", "`") end
keys["'"] = function() _M["m/f"].enclose_selection("'", "'") end
keys['"'] = function() _M["m/f"].enclose_selection('"', '"') end
keys['('] = function() _M["m/f"].enclose_selection('(', ')') end
keys['['] = function() _M["m/f"].enclose_selection('[', ']') end
@bokunodev
bokunodev / nord.lua
Last active May 14, 2021 15:22
Dark scheme for textadept with Nord color palette. ( look nice with go )
-- Copyright 2007-2020 Mitchell mitchell.att.foicica.com. See LICENSE.
-- Dark theme for Textadept.
-- Contributions by Ana Balan.
local view = view
local property, property_int = view.property, view.property_int
--[[ Nord palette
Polar Night
#2e3440
@bokunodev
bokunodev / split-chapter.py
Created May 6, 2021 21:54
auto split video into chapters
#!/usr/bin/python
import json, os
tracklist = [
"bird funeral [Introduction]",
"This is the happiness peace committee. [Introduction]",
"Unhappy Refrain [two of the switching]",
"Sugar Bits [switching of two]",
"Gakuen × ∀ssassinatioИ [two of the switching]",
@bokunodev
bokunodev / convert.sh
Created May 6, 2021 21:43
Batch convert flac to mp3 using ffmpeg with configurable quality
#!/bin/bash
if [ $MP3_QUALTY -eq "" ] ; then
MP3_QUALTY=3
fi
if [ $MP3_COMPRESSION -eq "" ] ; then
MP3_COMPRESSION=0
fi
@bokunodev
bokunodev / Makefile
Created April 26, 2021 13:09
Makepkg default flags in a makefile
all: help
build:
makepkg --ignorearch \
--clean \
--force \
--log \
--rmdeps \
--syncdeps \
--nosign \
@bokunodev
bokunodev / dragable.js
Created April 17, 2021 06:41
make html element, dragable.
// dragableElement(document.querySelector("#mydiv"))
function dragableElement(a) {
let f = 0,
g = 0,
d = 0,
e = 0
eh = a.querySelector("#header") || a
eh.onmousedown = function(b) {
b = b || window.event