Skip to content

Instantly share code, notes, and snippets.

@elig0n
elig0n / holidays.en-IL.rc
Created April 24, 2024 22:14
taskwarrior 2024 en-IL holidays (using hebcal)
# Created using hebcal and gawk
# hebcal -g --no-special -x | gawk '{ split($0, a, / /) ; date=a[1]; gsub(/-/, "", date); $1=""; desc=$0; sub(/ /, "", desc); print "holiday.en-IL" NR ".name=" desc ; print "holiday.en-IL" NR ".date=" date; }'
holiday.en-IL1.name=Tu BiShvat
holiday.en-IL1.date=20240125
holiday.en-IL2.name=Family Day
holiday.en-IL2.date=20240209
holiday.en-IL3.name=Purim Katan
holiday.en-IL3.date=20240223
holiday.en-IL4.name=Shushan Purim Katan
@elig0n
elig0n / holidays.en-US.rc
Created April 24, 2024 22:10
taskwarrior 2024 en-US (no regions) holidays
###############################################################################
# International Holiday Data provided by Holidata.net
# https://holidata.net/en-US/2021.json
# https://holidata.net/en-US/2022.json
#
# Copyright 2006 - 2021, Tomas Babej, Paul Beckingham, Federico Hernandez.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@elig0n
elig0n / dumprequest.php
Created April 19, 2024 05:50 — forked from magnetikonline/dumprequest.php
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI'],
$_SERVER['SERVER_PROTOCOL']
@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"