Skip to content

Instantly share code, notes, and snippets.

View sgtrusty's full-sized avatar

Santiago González sgtrusty

View GitHub Profile
@sgtrusty
sgtrusty / develbox.sh
Last active September 2, 2026 09:00
lazygit tester sandbox
#!/usr/bin/env bash
#
# Sandboxed install/run for the lazygit "stage-hunks-in-main-view" test build
# (https://github.com/jesseduffield/lazygit/issues/5974), using bubblewrap.
#
# Isolation properties:
# - The sandbox's ENTIRE userland (/usr, /bin, /lib, /etc, ...) is a small
# downloaded Alpine minirootfs, not your host's. Your real /usr, /etc,
# /bin etc. are never bound in at all -- the sandbox literally cannot
# read them. Only /etc/resolv.conf is shared from the host (just DNS
@sgtrusty
sgtrusty / osc-1717-AI-audit.md
Last active August 21, 2026 12:38
OSC 1717 protocol spec quick audit

Prompt:

audit https://github.com/jesseduffield/lazygit/compare/master...sh-integration

Response:

Web fetch is blocked by GitHub's robots.txt, but I have a sandboxed environment with network access to GitHub — let me clone the repo directly and diff the branches there instead.I cloned the repo and diffed `master...sh-integration` directly (267 files, +13,348/-5,521 — this is a large feature branch reworking lazygit's diff rendering, patch-building, and staging UI). Since it's all Go, classic memory-corruption bugs (buffer overflows, use-after-free) aren't really in play — the language rules those out. I focused on the categories that *do* matter in Go: injection, path handling, unchecked indexing (panic/DoS), and concurrency/data races. Here's what I found.

## Findings

**1. Possible path traversal into the custom-patch temp dirs (worth hardening)**`pkg/commands/git_commands/patch.go`, new function `WriteCustomPatchDiffTrees`:
@sgtrusty
sgtrusty / _no_code_page_.php
Created January 23, 2023 00:49 — forked from Dan-Q/_no_code_page_.php
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@sgtrusty
sgtrusty / ConditionalBindings.hs
Created October 4, 2022 01:27 — forked from LSLeary/ConditionalBindings.hs
Conditional key bindings for xmonad. WIP.
{-# LANGUAGE StandaloneDeriving, DeriveFunctor, GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
--------------------------------------------------------------------------------
-- Module : XMonad.Actions.ConditionalBindings
-- Description : A framework for producing conditional key bindings.
-- Copyright : (c) 2018 L. S. Leary
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : L. S. Leary
@sgtrusty
sgtrusty / README.txt
Created August 25, 2022 17:53 — forked from CSaratakij/README.txt
Video Wallpaper (hw-accelerate) : Use 'mpv' as a video player backend with 'xwinwrap' to wrap our window to be use as a desktop background
You want to use a live wallpaper in x11?
Great!!...but It come as a cost.
I did experiment with .gif backend and non hardware accelerate backend, It sucks.
CPU usage was so high (40% up just for idle), unacceptable for my laptop.
Running with those backend for such a really long time will slowly turn your laptop into the hot potato.
But don't be upset, we can reduce those cost.
Using the video player with hardware video decoding support can reduce the cost.
@sgtrusty
sgtrusty / Install i3 on arch.sh
Created August 9, 2022 15:23 — forked from chreniuc/Install i3 on arch.sh
Steps i followed to install arch + i3
timedatectl set-ntp true
timedatectl set-timezone Europe/Bucharest
fdisk /dev/sda
########################################
n 1G pentru /boot /dev/sda1
a - Flag it as bootable
n - 4G pentru swap /dev/sda3
n - 70G pentru / /dev/sda2
@sgtrusty
sgtrusty / arch-i3gaps-install.md
Created August 9, 2022 15:23 — forked from fjpalacios/arch-i3gaps-install.md
Arch + i3-gaps Install Guide

Arch + i3-gaps Install Guide

First set up your keyboard layout. For example, in Spanish:

   # loadkeys es

For a list of all acceptable keymaps:

   # localectl list-keymaps
@sgtrusty
sgtrusty / arch-i3gaps-install.md
Created August 6, 2022 00:54 — forked from m4jrt0m/arch-i3gaps-install.md
Arch + i3-gaps Install Guide

Arch + i3-gaps Install Guide

First set up your keyboard layout. For example, in Spanish:

   # loadkeys es

For a list of all acceptable keymaps:

   # localectl list-keymaps
@sgtrusty
sgtrusty / website-useful-codes.md
Last active February 9, 2021 01:39
Useful codes to use on the internet

useful codes to use on the internet

You can use these on the inspector's console, or save them as bookmarks by turning them into a oneliner and writing javascript: before the code.

optimization

  • Clear out website content in order to save RAM:
document.body.innerHTML = "";
document.head.innerHTML = "";
@sgtrusty
sgtrusty / npp-theme.xml
Last active December 15, 2020 22:24
Deep Black (sg)
<?xml version="1.0" encoding="Windows-1252" ?>
<!--
Style Name: Deep Black
Description: Based on the theme Port VibrantInk by tyler
File name: Deep Black.xml
Created by: Mariusz Kasperkiewicz
Personalized by: Santiago González
Featured language: SQL, C, C++, Pascal, Php, Css, JavaScript, Html, XML, others?
Note: Feel free to modify this style and re-release it. This style is available under the terms of the GNU Free License.