Skip to content

Instantly share code, notes, and snippets.

@elig0n
elig0n / getxkblayout.c
Created February 5, 2024 23:39 — forked from fikovnik/getxkblayout.c
Get keyboard layout using X11
// compile with `gcc -I/usr/include getxkblayout.c -lX11 -lxkbfile`
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>
int main(int argc, char **argv) {
Display *dpy = XOpenDisplay(NULL);
@elig0n
elig0n / open-in-firefox-nightly.sh
Last active December 16, 2023 13:31 — forked from SpotlightKid/open-in-firefox.sh
Open URL from Termux command line in Firefox Android browser
#!/bin/bash
#
# open-in-firefox-nightly.sh - open URL from Termux command line in Firefox Nightly Android browser
#
# Works with file:// URLs too, unlike with termux-open{-url}.
#
exec am start --user 0 -a android.intent.action.VIEW -n org.mozilla.fenix/.IntentReceiverActivity -d "$1" >/dev/null
//
// This program reads a sourcemap from stdin
// and replaces the "mappings" property with
// human readable content. It writes the output
// to stdout.
//
// 1. install the dependencies:
// npm i concat-stream vlq
//
// 2. optional: install jq for pretty printing json
@elig0n
elig0n / _dunstctl
Created September 5, 2022 00:58
dunstctl zsh completion script
#compdef _dunstctl dunstctl
# Depends on: gAWK (rule), jq (history-pop)
local curcontext="$curcontext" ret=1
local -a state line subs
if [[ -v XDG_CONFIG_HOME || -n "$XDG_CONFIG_HOME" ]]; then
local DUNSTRC="$XDG_CONFIG_HOME/dunst/dunstrc"
else
local DUNSTRC=$HOME/.config/dunst/dunstrc
@elig0n
elig0n / tcpdump.awk
Last active May 13, 2022 23:29
Colorized tcpdump output via awk
#!/usr/bin/awk -f
# tcpdump regular output color wrapper
# usage: tcpdump [options] | awk -f tcpdump.awk
BEGIN {
yellow="\033[33m"
reset="\033[0m"
teal="\033[36m"
lightred="\033[91m"
magenta="\033[35m"
[skin]
description=Ajnasz Blue Theme. Midnight Commander skin from Ajnasz.
[Lines]
horiz=─
vert=│
lefttop=┌
righttop=┐
leftbottom=└
rightbottom=┘
@elig0n
elig0n / chanhop.sh
Created August 4, 2020 16:12 — forked from hnw/chanhop.sh
#!/bin/bash
# Channel hopping shell script
# GPLv2
# Portions of code graciously taken from Bill Stearns defragfile
# http://www.stearns.org/defragfile/
#
# jwright@hasborg.com
# Defaults
BANDS="IEEE80211B"
@elig0n
elig0n / README-cdx.md
Created July 7, 2020 22:47 — forked from programus/README-cdx.md
Extended windows cd command

CDX Command - CD eXtension batch file

This is a batch file could help you change working directory easier especially you need to change many directories very often like me.

Features

  • Save histroy of all navigated directories
  • No duplicated directories in histroy
  • Name history directories
  • Jump into any directory in histroy by index or name
  • Quich jump into previous directory
  • Maintain history list
@elig0n
elig0n / copy-permalink.lua
Last active June 18, 2020 11:48 — forked from olejorgenb/copy-permalink.lua
mpv user script: copy a command that will resume video at current position
@elig0n
elig0n / python-run.vimrc
Created May 17, 2020 17:25 — forked from vishnubob/python-run.vimrc
Add this to your .vimrc to execute python in a new window. If your program produces no output, no windows is created.
nnoremap <silent> <leader><space> :call SaveAndExecutePython()<CR>
vnoremap <silent> <leader><space> :<C-u>call SaveAndExecutePython()<CR>
" https://stackoverflow.com/questions/18948491/running-python-code-in-vim
function! SaveAndExecutePython()
" SOURCE [reusable window]: https://github.com/fatih/vim-go/blob/master/autoload/go/ui.vim
" save and reload current file
silent execute "update | edit"