Skip to content

Instantly share code, notes, and snippets.

@bokunodev
bokunodev / go.mod
Created Jan 22, 2022
example cookie on differ ports
View go.mod
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 / print.c
Created Jun 14, 2021
Print decimal binary in C
View print.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 / table.c
Last active Jun 14, 2021
Hash Table in C11
View table.c
#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 / Makefile
Last active May 19, 2021
Print 2D matrix
View Makefile
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 / split-chapter.py
Created May 6, 2021
auto split video into chapters
View split-chapter.py
#!/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
Batch convert flac to mp3 using ffmpeg with configurable quality
View convert.sh
#!/bin/bash
if [ $MP3_QUALTY -eq "" ] ; then
MP3_QUALTY=3
fi
if [ $MP3_COMPRESSION -eq "" ] ; then
MP3_COMPRESSION=0
fi
@bokunodev
bokunodev / Makefile
Created Apr 26, 2021
Makepkg default flags in a makefile
View Makefile
all: help
build:
makepkg --ignorearch \
--clean \
--force \
--log \
--rmdeps \
--syncdeps \
--nosign \
@bokunodev
bokunodev / dragable.js
Created Apr 17, 2021
make html element, dragable.
View dragable.js
// 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
@bokunodev
bokunodev / nord.micro
Last active Dec 4, 2020
Nordic colorscheme for Micro text editor.
View nord.micro
color-link default "#d8dee9,#2e3440"
color-link comment "#4c566a,"
# color-link comment.bright
color-link identifier "#5e81ac,"
# color-link identifier.class
# color-link identifier.macro
# color-link identifier.var
color-link constant "#bf616a,"
# color-link constant.bool
# color-link constant.bool.true
@bokunodev
bokunodev / gs_rgb2cymk
Last active Nov 19, 2020
convert pdf file from RGB to CYMK using ghost script
View gs_rgb2cymk
#!/usr/bin/bash
help(){
echo "Usage: $0 <input.pdf> <output.pdf> [safe]"
echo "optional \`safe\` option, preform less processing, possibly better quality with a much larger file size."
exit 127
}
if [[ $1 == "" ]] ; then
echo "Missing parameter input pdf file"
help