Skip to content

Instantly share code, notes, and snippets.

View webgtx's full-sized avatar
:accessibility:
Hope is not a strategy

Alex Zolotarov webgtx

:accessibility:
Hope is not a strategy
View GitHub Profile
@webgtx
webgtx / fixtinycursoronwaylandflatpak.md
Created March 16, 2025 10:14
How to fix tiny cursor on flatpak that runs a wayland session

Add this flatpak environment variable globally

XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons

You can do it with a Flatseal if you prefer GUI.

Alternatively, you can copy paste this command to do the job.

flatpak --user override --env "XCURSOR_PATH=/run/host/user-share/icons:/run/host/share/icons"
@webgtx
webgtx / .Xresources
Created February 9, 2025 21:27
Enable copy/paste (URXVT)
! Restore Ctrl+Shift+(c|v)
URxvt.keysym.Shift-Control-V: eval:paste_clipboard
URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard
URxvt.iso14755: false
URxvt.iso14755_52: false
! Appearance
URxvt.font: xft:Monospace:size=12
URxvt.background: black
URxvt.foreground: white
@webgtx
webgtx / vimtips.md
Last active January 22, 2025 06:05
How to search pattern within selected area/text in VIM
  1. First, visually select the area you want to search in.
  2. Enter the normal mode.
  3. Then hit / and type this in the search bar:
\%Vpattern
@webgtx
webgtx / ipdboverpdb.md
Created January 20, 2025 06:54
How to set IPDB as default debbuger instead of PDB

The Issue

By default, when you call breakpoint() you enter PDB even if you have installed ipdb in your virtual environemnt.

Solution

Just export this environment variable

export PYTHONBREAKPOINT=ipdb.set_trace
@webgtx
webgtx / dynamic_prompt.c
Created January 16, 2025 14:55
Prompt a string in C with no buffer limits, by using dynamic string / dynamic memory allocation
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
typedef struct node {
char ch;
struct node* next;
} node;
node* type(node* next);
@webgtx
webgtx / learnvimthehardway_darkmode_support.css
Created January 14, 2025 15:17
Dark Mode support for the "Learn Vimscrip The Hard Way"
@media (prefers-color-scheme: dark) {
body {
background: #202020;
color: silver;
}
a {
color: white;
}
@webgtx
webgtx / howtoremovenewlinefromthestring.c
Created December 23, 2024 20:01
How to remove newline from the string in C
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#define BUFFER_SIZE 512
int main(void)
{
char* string = malloc(sizeof(char) * BUFFER_SIZE);
if (!string) return 1;
@webgtx
webgtx / creditcardvalidator.py
Created August 29, 2024 09:15
Luhn Algorithm in Python
from fire import Fire
def checksum(cardnumber: int):
cardnumber = [int(i) for i in str(cardnumber)]
cardnumber.reverse()
odd = [v for i, v in enumerate(cardnumber) if i % 2 == 0]
even = [v for i, v in enumerate(cardnumber) if i % 2 != 0]
even_sum = int()
for i in even:

How to change prefers-color-scheme via gsettings

I recently encountered an issue where my Google Chrome browser was unable to set the prefers-color-scheme option to dark, even though I had configured it to do so in the gtk settings.ini file. This problem only occurred with Sway; in other desktop environments, Chrome set that option correctly.

The solution to this problem was the following command:

gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
@webgtx
webgtx / gist:22f8f02b7d019237c5eccabaee2883d3
Last active August 11, 2024 04:38
System Container Unit
# $HOME/.config/containers/systemd/alpinetop.container
[Unit]
Description=Alpine with a running top
after=local-fs.target
[Container]
Image=docker.io/alpine:3.16
Exec=top
[Install]