Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
kissgyorgy / http_over_ssh_proxy.py
Last active December 24, 2023 16:35
Python: HTTP over SSH
import asyncio
import sys
from typing import Optional
import asyncssh
import httpx
class MySSHTCPSession(asyncssh.SSHTCPSession):
def __init__(self):
@sebastiancarlos
sebastiancarlos / open_links_with_keyboard.bash
Last active August 25, 2023 02:55
Opening links in your Bash terminal with the keyboard
@sebastiancarlos
sebastiancarlos / custom-type.bash
Last active August 23, 2023 11:48
Custom version of the Bash 'type' command, navigating symlinks and aliases.
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/shorts/mYfEIZFlIwo
# Put this in your .bashrc or something like that
# pretty_print_directory
# - replace $HOME with ~
# - make everything before the last '/' green, and everything after white and
# bold
@sebastiancarlos
sebastiancarlos / tari.bash
Last active August 23, 2023 11:51
tari - tar "in-place" - Remove duplicates when operating on tar archives
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=IyzNz1uPEGg
# deleteAllButMostRecentInTar
# source: https://stackoverflow.com/a/71666950/21567639
function deleteAllButMostRecentInTar()
{
local archive=$1
local filesToDelete=$(mktemp)
@sebastiancarlos
sebastiancarlos / custom-locate.bash
Last active August 23, 2023 11:52
locate is great, but you can make it faster with a custom updatedb
# All my gist code is licensed under the terms of the MIT license.
# Video demo: https://www.youtube.com/watch?v=KFtZbsSG_fA
# add this to your ~/.bashrc or something like that
# alias for every locate database
alias locate="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb-min"
alias locatehome="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb-home"
alias locateall="glocate --regextype=posix-extended --database=${HOME}/tmp/locatedb"

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@akihikodaki
akihikodaki / README.en.md
Last active October 28, 2024 15:20
Linux Desktop on Apple Silicon in Practice

Linux Desktop on Apple Silicon in Practice

I bought M1 MacBook Air. It is the fastest computer I have, and I have been a GNOME/GNU/Linux user for long time. It is obvious conclusion that I need practical Linux desktop environment on Apple Silicon.

Fortunately, Linux already works on Apple Silicon/M1. But how practical is it?

  • Two native ports exist.
@tdcosta100
tdcosta100 / WSL2GUIXvnc-en.md
Last active November 23, 2024 01:38
A tutorial to use GUI in WSL2 replacing original XServer by Xvnc, allowing WSL to work like native Linux, including login screen

WSL2 with GUI using Xvnc

Note

If you want to use pure WSLg, you can try the new WSLg (XWayland) tutorial or the WSLg (Wayland) tutorial.

In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, etc, all of them might work flawlessly).

The key component we need to install is the desktop metapackage you want (GNOME, KDE, Xfce, Budgie, etc) and tigervnc-standalone-server.

For this setup, I will use Ubuntu (20.04, 22.04 and 24.04 are working), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the [Sample

@kasuken
kasuken / profiles.json
Created June 23, 2019 12:22
Windows Terminal settings and files
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{
@RamonGilabert
RamonGilabert / bluetooth.sh
Last active October 12, 2023 18:24
Bluetoothctl automation
#!/usr/bin/expect -f
set prompt "#"
set address [lindex $argv 0]
spawn sudo bluetoothctl -a
expect -re $prompt
send "remove $address\r"
sleep 1
expect -re $prompt