Skip to content

Instantly share code, notes, and snippets.

View xyproto's full-sized avatar
🥸
Perpetually focused

Alexander F. Rødseth xyproto

🥸
Perpetually focused
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Background Mountains</title>
<style>
body {
background-color: #F7FFFF;
margin: 0;
@xyproto
xyproto / s.go
Created October 8, 2025 13:19
systemd service starter/stopper with a TUI, for Linux
package main
import (
"bufio"
"fmt"
"os"
"os/exec"
"strings"
tea "github.com/charmbracelet/bubbletea"
@xyproto
xyproto / upsie.go
Created October 8, 2025 12:53
Show uptime + selected uname info in a nice and brief way, with colors, for Linux
package main
import (
"bytes"
"flag"
"fmt"
"io"
"os"
"strconv"
"strings"
@xyproto
xyproto / mouseboid.go
Last active October 8, 2025 13:12
Make the mouse cursor move in boid-like ways, for Windows (shake to pause)
package main
import (
"fmt"
"math"
"syscall"
"time"
"unsafe"
)
// Simple C benchmark
#include <stdio.h>
#include <time.h>
inline int parse_bin_digit(const int ch)
{
switch (ch) {
case '0':
return 0;
package main
//
// Example program for checking errors when adding users.
//
// HOWEVER it might be better to instead check that the values are as expected
// in the Redis database AFTER adding them.
//
import (
@xyproto
xyproto / README.md
Last active February 28, 2026 23:06
Configuration for the Nano editor - red/black theme

Alias for .bashrc or .zshrc:

sh alias nano="LC_ALL=en_US.UTF-8 nano --smarthome --autoindent --linenumbers --mouse --historylog --trimblanks --backupdir=$HOME/.backup --rcfile=$HOME/.config/nano/config --nohelp --tempfile"

@xyproto
xyproto / props.go
Created October 3, 2018 16:06
List user properties with permissionbolt and simplebolt
package main
import (
"fmt"
"github.com/coreos/bbolt"
"github.com/xyproto/permissionbolt"
"github.com/xyproto/simplebolt"
"log"
"os"
"path"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
extern char* go_add(char*, char*) __asm__ ("example.main.Add");
char* __go_string_plus(char *a, char *b) {
char *c = malloc((strlen(a) + strlen(b) + 1));
strcat(c, a);
strcat(c, b);
@xyproto
xyproto / GC.md
Last active August 1, 2017 17:22
Garbage collection is not mandatory in Go

Go

Disable garbage collection:

debug.SetGCPercent(-1)

Trigger garbage collection:

runtime.GC()