Skip to content

Instantly share code, notes, and snippets.

View Techcable's full-sized avatar
🇺🇸
Procrastinating

Techcable

🇺🇸
Procrastinating
View GitHub Profile
@Techcable
Techcable / LICENSE.md
Created March 23, 2024 23:08
License file for dual-licensing under Apache-2.0 and BlueOak-1.0.0

License

This project is dual-licensed under the either the Apache License 2.0 or the Blue Oak Model License 1.0.0, at your option.

Both licenses are OSI Approved. Copies are available in the licenses/ directory.

Automatic Contributor License

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

@Techcable
Techcable / LICENSE.txt
Created August 27, 2023 01:42
The Apache 2.0 License with LLVM Exception (SPDX ID: `Apache-2.0 WITH LLVM-exception`)
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@Techcable
Techcable / listfiles.sh
Created August 19, 2023 06:04
Simple shell script to list files
#!/bin/bash
if [[ "$#" -ne 2 ]]; then
echo "ERROR: Invalid number of arguments" >&2;
echo >&2;
echo "Usage: ./listfiles.sh <directory> <outfile>" >&2;
exit 1;
fi
TARGET_DIR="$1";
#!/bin/sh
confirm() {
local prompt="$1";
local default;
case "$2" in
true | True | yes)
default="True";
;;
false | False | no)
@Techcable
Techcable / byte_format.py
Created August 18, 2023 03:19
Minature python library which formats bytes for user display
from decimal import Decimal
from enum import IntEnum
from numbers import Real
class ByteUnit(IntEnum):
BYTE = 1
KILLIBYTE = 1024**1
MEGABYTE = 1024**2
GIGABYTE = 1024**3
@Techcable
Techcable / convert_bookmarks.py
Created June 25, 2023 05:37
Convert Firefox bookmarks json -> raindrop.io CSV
"""Converts firefox's JSON bookmarks format to the CSV format raindrop.io expects
See here for docs on raindrop: https://help.raindrop.io/import/#csv
"""
from __future__ import annotations
from typing import (
ClassVar, Iterable, NewType, Any, Iterator
)
from enum import Enum, nonmember as enum_nonmember
@Techcable
Techcable / klib.wrap
Last active January 16, 2023 22:43
Meson Wrapfile for klib
# Website: https://attractivechaos.github.io/klib/
# Source: https://github.com/attractivechaos/klib
#
# Meson Wrap Gist:
# Meson Wrap Version: 1
[wrap-git]
url = https://github.com/attractivechaos/klib.git
revision = head
patch_directory = klib
@Techcable
Techcable / fend-unitfmt.janet
Created November 16, 2022 02:13
A Janet script to wrap fend and format units [WIP]
(import sh)
(import spork)
(def- metric-prefixes ["K" "M" "G" "T" "P" "E"])
(defn- makeunit [&named name base-prefix binary]
(default binary false)
(assert (keyword? name))
(assert (not (empty? (string name))))
(assert (string? base-prefix))
@Techcable
Techcable / minimized.zig
Created August 26, 2022 04:55
stage3 regression for comptime slice concat (need explicit comptime block)
const std = @import("std");
fn sdk_root() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}
fn dep_root_working() []const u8 {
const sdk_root_val = comptime blk: { break :blk sdk_root(); };
return sdk_root_val ++ "/deps/mpack";
}
@Techcable
Techcable / getjanet.sh
Last active August 20, 2022 03:07
A small bash script to download & compile the Janet CLI
#!/bin/bash
# Available as github gist: https://gist.github.com/Techcable/b83df781602857dd2f6cf0074e50ba77
set -e
if [[ $# -eq 1 ]]; then
OUT_FILE="$(realpath "$1")";
else
echo "ERROR: Invalid arguments" >&2;