Skip to content

Instantly share code, notes, and snippets.

View TheBigRoomXXL's full-sized avatar
⚗️
experimenting

TheBigRoomXXL TheBigRoomXXL

⚗️
experimenting
View GitHub Profile
@TheBigRoomXXL
TheBigRoomXXL / multi_line_terminal_output.py
Last active July 22, 2024 08:19
Update multiple lines of terminal output
"""Stolen from:
https://stackoverflow.com/questions/66615552/display-multi-line-python-console-ascii-animation
"""
import time
nlines = 5
# scroll up to make room for output
print(f"\033[{nlines}S", end="")
@TheBigRoomXXL
TheBigRoomXXL / decoder.go
Created June 22, 2024 11:01
8086 assembly decoder part1
package main
import (
"fmt"
"io"
"os"
)
func main() {
filePath := os.Args[1]
// language=GLSL
const SHADER_SOURCE = /*glsl*/ `
precision highp float;
varying vec4 v_color;
varying vec2 v_diffVector;
varying float v_radius;
varying vec4 v_texture;
varying float v_texture_index;
// language=GLSL
const VERTEX_SHADER_SOURCE = /*glsl*/ `
attribute vec4 a_id;
attribute vec4 a_color;
attribute vec2 a_position;
attribute float a_size;
attribute float a_angle;
attribute vec4 a_texture;
attribute float a_texture_index;
import type { Attributes } from "graphology-types";
import { NodeProgram } from "sigma/rendering";
import type { Sigma } from "sigma";
import type {
NodeHoverDrawingFunction,
NodeLabelDrawingFunction,
NodeProgramType,
ProgramInfo
} from "sigma/rendering";
import type { NodeDisplayData, RenderParams } from "sigma/types";
import { EventEmitter } from "events";
/**
* Useful types:
* *************
*/
export type ImageState = {
image: HTMLImageElement;
status: "loading" | "ready" | "error" | "drawn";
x: number;
@TheBigRoomXXL
TheBigRoomXXL / tmux.conf
Created April 5, 2024 11:34
Minimal tmux config
# Colors
set -g default-terminal "screen-256color"
# New prefix
set-option -g prefix C-b
set-option -g prefix C-q
# Enable mouse
set -g mouse on
// Insert using sql.DB with transaction
func InsertPage(db *sql.DB, url string, content string) error {
// Open transaction
tx, err := db.Begin()
if err != nil {
return err
}
@TheBigRoomXXL
TheBigRoomXXL / node-image-renderer.ts
Last active January 24, 2024 08:47
ImageNode with crossorigin
/**
* Sigma.js WebGL Renderer Node Program
* =====================================
*
* Program rendering nodes using GL_POINTS, but that draws an image on top of
* the classic colored disc.
* @module
*/
// import { Coordinates, Dimensions, NodeDisplayData } from "../../../types";
// import { floatColor } from "../../../utils";
@TheBigRoomXXL
TheBigRoomXXL / img-zoom.html
Created December 15, 2023 09:07
A zoomable image with just a bit of css and js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Loading Optimisation</title>
<style>
figure.zoom {
background-position: 50% 50%;