Skip to content

Instantly share code, notes, and snippets.

View TeddyDD's full-sized avatar

Daniel Lewan TeddyDD

View GitHub Profile
@TeddyDD
TeddyDD / btrfs-guide.md
Created April 7, 2024 16:59 — forked from MaxXor/btrfs-guide.md
Btrfs guide to set up an LUKS-encrypted btrfs raid volume with included maintenance & recovery guide

Encrypted Btrfs storage setup and maintenance guide

Initial setup with LUKS/dm-crypt

This exemplary initial setup uses two devices /dev/sdb and /dev/sdc but can be applied to any amount of devices by following the steps with additional devices.

Create keyfile:

dd bs=64 count=1 if=/dev/urandom of=/etc/cryptkey iflag=fullblock
chmod 600 /etc/cryptkey
@TeddyDD
TeddyDD / extract_cookies.sh
Last active August 11, 2022 08:52 — forked from hackerb9/extract_cookies.sh
Extract cookies.sqlite to cookies.txt for use in wget or curl.
#!/bin/sh -e
# extract_cookies.sh:
#
# Convert from Firefox's cookies.sqlite format to Netscape cookies,
# which can then be used by wget and curl. (Why don't wget and curl
# just use libsqlite if it's installed?)
# USAGE:
#
# $ extract_cookies.sh > /tmp/cookies.txt
#!/bin/sh
# Source https://github.com/sdushantha/dotfiles/blob/master/bin/bin/utils/ocr
TEXT_FILE="/tmp/ocr.txt"
IMAGE_FILE="/tmp/ocr.png"
# Check if the needed dependencies are installed
dependencies="tesseract-ocr
maim
notify-send
@TeddyDD
TeddyDD / fts-fdir.sql
Created March 13, 2021 21:39
Full text seach on files imported from fsdir in SQLite
CREATE virtual table file_search using fts5 (path, file, tokenize = 'unicode61');
INSERT into file_search
SELECT name,
data
FROM fsdir('some/path')
WHERE name like "%.md";
SELECT path,
snippet(file_search, 1, '', '', '...', 5) AS snippet
@TeddyDD
TeddyDD / kak-lsp.toml
Created March 22, 2020 11:30
kak lsp gopls settings
[language.go]
filetypes = ["go"]
roots = ["Gopkg.toml", "go.mod", ".git", ".hg"]
command = "gopls"
args = ["serve"]
offset_encoding = "utf-8"
[language.go.initialization_options]
usePlaceholders = false
hoverKind = "SynopsisDocumentation"
@TeddyDD
TeddyDD / options.go
Created February 24, 2020 18:44
Go option funcs pattern
package main
import "fmt"
type Person struct {
Name string
Age int
}
type personOption func(*Person)
local ffi = require('ffi')
--local lib = ffi.load('libraylib.2.0.0.dylib')
local lib = ffi.load('libraylib')
ffi.cdef[[
// Vector2 type
typedef struct Vector2 {
float x;
float y;
} Vector2;
@TeddyDD
TeddyDD / mozyt.cr
Last active September 4, 2018 11:43
most viewed yt wideos from firefox history
#!/usr/bin/env crun
# ---
# sqlite3:
# github: crystal-lang/crystal-sqlite3
# ...
# Lists most visited youtube wideos from Firefox history
# Example: Backup videos watched > 10 times
# youtube-dl $(mozyt.cr -p ~/.mozilla/firefox/PROFILEID.default/)
require "option_parser"
@TeddyDD
TeddyDD / plug.kak
Created September 2, 2018 10:41
plugin manager for Kakoune
define-command plug -params 1..2 %{
%sh{
plugdir="/$HOME/.config/kak/src"
[ -d $plugdir ] || mkdir -p "$plugdir"
repo=$(basename $1)
if [ ! -d "$plugdir/$repo" ]; then
git clone "https://github.com/$1" "$plugdir/$repo"
fi
if [ ! -z "$2" ]; then
i3 https://github.com/khamer/base16-i3/blob/master/themes/base16-solarized-light.config
xresources https://github.com/solarized/xresources/blob/master/Xresources.light
Firefox (require Color experiment)
https://color.firefox.com/?theme=XQAAAAL7AAAAAAAAAABBqYhm849SCiazH1KEGccwS-xNVAWBvuCXoU-oppwsBPRygLYBkMG1E2vhIyoJN9awg1HxriPdSQBKr3z8eJDdEo1EJW9RHCMPU04e4tjV2LZdCxc5uLqcwFh-u3j9LM7TCP4lMhoy2LBdlZOeznYZaBhbrVCEaTemWVJYHyWLUo7dHpXGUCop2ED7K7kLh16sz6WdhMVAzYPdJFbV0L6xYn66_X-V1lvbkmSRzv_q8ngA
Userstyles: https://github.com/alphapapa/solarized-everything-css
Kakoune - custom theme based on https://github.com/jan-warchol/selenized
alternative: https://github.com/robertmeta/nofrils