Skip to content

Instantly share code, notes, and snippets.

View siberex's full-sized avatar
🛠️
Your stack will not be full without me

Stephen Jingle siberex

🛠️
Your stack will not be full without me
View GitHub Profile
@siberex
siberex / range.js
Last active December 23, 2025 15:39
Mimic Python range() for JS
// Mimic Python range:
// [...range(10)] → [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
// [...range(3, 6)] → [3, 4, 5]
// [...range(3, 20, 2)] → [3, 5, 7, 9, 11, 13, 15, 17, 19]
// for (const i of range(1, 6)) console.log(i);
function* range(from, upTo, step = 1) {
if (upTo == undefined) {
upTo = from;
from = 0;
}
@siberex
siberex / insulalabs.sh
Last active August 26, 2025 21:06
Snippets for insulalabs.io to put into .zshrc
# → https://insulalabs.io/#keys
export INSULA_API_KEY=...
insi_set() {
if [ "$#" -ne 2 ]; then
echo "Missing key and/or value. Usage: $0 KEY VALUE" >&2
return 1
fi
# Set a value
@siberex
siberex / lol.go
Last active August 3, 2025 15:50
Golang vs Node.js slices
package main
import "fmt"
func main() {
a1 := []int{1, 2, 3, 4, 5}
a2 := a1[1:3]
a2 = append(a2, 10, 20)
fmt.Println(a1) // [1 2 3 10 20]
fmt.Println(a2) // [2 3 10 20]
@siberex
siberex / str_to_upper.go
Created July 18, 2025 21:22
Test golang strings.ToUpper with UTF-8 strings
package main
import "fmt"
import "strings"
// go run str_to_upper.go
// Compare with C++: https://gist.github.com/siberex/7684eadde46d5e119b3bc4c6d5ab6212
func main() {
strTestUpper1 := "hello🌍world"
strTestUpper2 := "naïve café"
@siberex
siberex / str_to_upper.cpp
Last active July 18, 2025 21:20
Simple toUpper() implementation for UTF-8 strings with stdlib only (without Boost or ICU)
/**
* strings
*
* Author: Stephen Jingle <sib.li>
* Created: 13 Jul 2025
*/
#include <cctype>
#include <cwctype>
@siberex
siberex / toupper_claude.cpp
Last active July 15, 2025 20:55
[FAILED] Attempt to implement string toUpperCase with LLM
#include <string>
#include <string_view>
#include <locale>
#include <codecvt>
#include <algorithm>
class UTF8ToUpperCase {
private:
static thread_local std::string result_buffer;
@siberex
siberex / toupper_deepseek.cpp
Last active July 15, 2025 20:55
[FAILED] Attempt to implement string toUpperCase with LLM
#include <cctype>
#include <cstdint>
#include <iostream>
#include <string>
#include <string_view>
static char32_t to_upper(char32_t cp) {
if (cp >= 'a' && cp <= 'z') {
return cp - ('a' - 'A');
}
@siberex
siberex / spotlight.md
Last active July 14, 2025 22:47
MacOS Spotlight issues

First steps

sudo killal mds
sudo killall -9 mds

mdutil

@siberex
siberex / abseil-vs-boost.md
Created July 10, 2025 18:28
Abseil vs Boost C++ library collections comparison [LLM-generated]

Link: https://gist.github.com/siberex/7ff8b24778a31124b178a299442159d6

Main Differences Between Abseil and Boost

Aspect Abseil Boost
Purpose Modern C++ utilities for performance, simplicity, and Google-style coding. Broad, comprehensive set of libraries for general-purpose C++ development.
Design Philosophy Focuses on modern C++ (C++11/14/17), clean APIs, and production-grade code. Older, supports pre-C++11, with some legacy and verbose APIs.
Size & Scope Leaner, focused on core utilities (e.g., containers, strings, time). Massive, with over 160 libraries (e.g., networking, math, filesystem).
License
// AoC2024. Day 6. Deoptimized version
let INPUT = await fetch('https://adventofcode.com/2024/day/6/input')
.then(response => response.text())
.catch(err => console.error(err));
/*
INPUT = `....#.....
.........#
..........