Skip to content

Instantly share code, notes, and snippets.

View sweetbbak's full-sized avatar

sweet sweetbbak

View GitHub Profile

Private Mode for In-Band Window Resize Notifications

Terminal emulators typically receive window resize events by installing a signal handler for the SIGWINCH signal. Handling of these signals can create challenges due to their inherently racy properties. Resize events must be synchronized with other application state in a safe manner.

Standard control sequences exist to query the current terminal size from the terminal and receive an in-band control sequence with the window size. However, this system requires polling - which is not ideal. Usually, SIGWINCH handling

@sebastiancarlos
sebastiancarlos / grepdist.sh
Last active August 5, 2023 13:57
Grepdist - Print the number of matches in each 10% section of a file
#!/usr/bin/env bash
# All my gist code is licensed under the terms of the MIT license.
# GREPDIST
# Print the number of matches in each 10% section of the file
#
# Example with grep:
# $ grep -c 'Napoleon' war_and_peace.txt
# 576
@adalinesimonian
adalinesimonian / block-the-blue.md
Last active October 9, 2024 18:45
Block all verified Twitter accounts on screen
@8KCoffeeWizard
8KCoffeeWizard / starship.toml
Created October 19, 2022 06:53
starship config
# Warning: This config does not include keys that have an unset value
# $all is shorthand for $username$hostname$localip$shlvl$singularity$kubernetes$directory$vcsh$git_branch$git_commit$git_state$git_metrics$git_status$hg_branch$docker_context$package$cmake$cobol$dart$deno$dotnet$elixir$elm$erlang$golang$haskell$helm$java$julia$kotlin$lua$nim$nodejs$ocaml$perl$php$pulumi$purescript$python$rlang$red$ruby$rust$scala$swift$terraform$vlang$vagrant$zig$buf$nix_shell$conda$memory_usage$aws$gcloud$openstack$azure$env_var$crystal$custom$sudo$cmd_duration$line_break$jobs$battery$time$status$container$shell$character
format = '$all'
right_format = ''
continuation_prompt = '[∙](bright-black) '
scan_timeout = 30
command_timeout = 500
add_newline = true
@morrolinux
morrolinux / linux-full-desktop-container.md
Last active November 9, 2024 01:17
Run a full linux desktop in a container

In the following gist I'm going to guide you through the process of installing and booting an entire linux distribution with full desktop environment just like you would have with a classical VM, but with much better performance and much worse isolation :)

The reason why I did this was mainly because it's cool, but also to test new distros with decent graphics performance without actually booting them on my PC.

If you "try this at home" just keep in mind a container is not as secure as a VM, and some of the option we're going to explore will weaken container isolation from "a bit risky" to "totally unsafe" depending on what you choose.

Also, we're going to use systemd-nspawn for containers as it's probably the best fit for our use case and can also boot any linux partition without needing to prepare an apposite container image.

Less go!

@exzork
exzork / GM Handbook.txt
Last active October 26, 2024 01:08
GM Handbook for Grasscutter
// Grasscutter 2.7.0 GM Handbook
// Created 2022/05/31 17:46:25
// Commands
sendmessage : Sends a message to a player as the server
setfetterlevel : Sets your fetter level for your current active character
setworldlevel : Sets your world level (Relog to see proper effects)
setstats : Sets fight property for your current active character
give : Gives an item to you or the specified player
@taskylizard
taskylizard / fmhy.md
Last active November 16, 2024 07:02
/r/freemediaheckyeah, in one single file (view raw)
@ssokolow
ssokolow / update_flatpak_cli.py
Last active November 4, 2024 19:38
Utility for making Flatpak-installed apps available in the terminal through their normal command names
#!/usr/bin/env python3
"""Flatpak CLI Shortcut Generator
A simple no-argument tool that generates launchers with traditional non-flatpak
command names for your installed Flatpak applications in ~/.local/bin/flatpak.
Does full collision detection and warns you if you forgot to add its output
directory to your PATH. Also overrules the command-line specified in the
``.desktop`` file if the Flatpak maintainer didn't include support for
command-line arguments.
@upbit
upbit / README.md
Last active November 16, 2024 13:49 — forked from ZipFile/README.md
Pixiv OAuth Flow (with Selenium)

Retrieving Auth Token (with Selenium)

  1. Setup, install Selenium/ChromeDriver
pip install selenium
# download chromedriver from https://chromedriver.storage.googleapis.com/index.html?path=91.0.4472.101/
# eg: wget https://chromedriver.storage.googleapis.com/91.0.4472.101/chromedriver_mac64.zip && unzip chromedriver_mac64.zip
shader_type canvas_item;
uniform vec4 color_1 = vec4(.0, .0, .0, 1.0);
uniform vec4 color_2 = vec4(0.5, 0.5, 0.5, 1.0);
void fragment() {
vec4 colors[2] = {color_1, color_2};
float min_diff = -1.0;