Skip to content

Instantly share code, notes, and snippets.

View xandkar's full-sized avatar
🤔
quis custodiet ipsos custodes?

Siraaj Khandkar xandkar

🤔
quis custodiet ipsos custodes?
View GitHub Profile
@xandkar
xandkar / gist:e1186acb0b4fd42cf495cd9fb17f0d23
Created June 27, 2019 01:07 — forked from Spoygg/gist:3122226
Keyboard switches for XKB setxkbmap
altwin:menu = +altwin(menu)
altwin:meta_alt = +altwin(meta_alt)
altwin:ctrl_win = +altwin(ctrl_win)
altwin:meta_win = +altwin(meta_win)
altwin:left_meta_win = +altwin(left_meta_win)
altwin:super_win = +altwin(super_win)
altwin:hyper_win = +altwin(hyper_win)
altwin:alt_super_win = +altwin(alt_super_win)
altwin:swap_lalt_lwin = +altwin(swap_lalt_lwin)
grp:switch = +group(switch)
@xandkar
xandkar / gist:20dd9fc20cf1543e59009e568d2af25d
Created June 27, 2019 01:07 — forked from Spoygg/gist:3122226
Keyboard switches for XKB setxkbmap
altwin:menu = +altwin(menu)
altwin:meta_alt = +altwin(meta_alt)
altwin:ctrl_win = +altwin(ctrl_win)
altwin:meta_win = +altwin(meta_win)
altwin:left_meta_win = +altwin(left_meta_win)
altwin:super_win = +altwin(super_win)
altwin:hyper_win = +altwin(hyper_win)
altwin:alt_super_win = +altwin(alt_super_win)
altwin:swap_lalt_lwin = +altwin(swap_lalt_lwin)
grp:switch = +group(switch)
@xandkar
xandkar / init.c
Created January 17, 2019 20:15 — forked from rofl0r/init.c
minimal init daemon by rich felker, author of musl libc
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;
@xandkar
xandkar / systemd.erl
Created July 27, 2018 17:09 — forked from maxlapshin/systemd.erl
Systemd support
-module(systemd).
% This is what you need to adopt systemd in erlang
%
% Do whatever you want license. If you want, you can take this code under terms of MIT license.
-export([ready/0, reloading/0, stopping/0, watchdog/0]).
-export([start_link/0]).
-export([init/1, handle_info/2, terminate/2]).
#! /bin/bash
set -e
BIN=$HOME/bin
#------------------------------------------------------------------------------
# Notifications
#------------------------------------------------------------------------------
DUNST_LOG_DIR=$HOME/var/log/dunst
@xandkar
xandkar / notes.md
Created March 17, 2018 20:14 — forked from aerosol/notes.md
The Year Of Linux Desktop

PC

  • LG 27UD69P-4k
    • expecting 2.0 1080p worst case
  • Crystal Series case 570X RGB
  • Silent Loop 360 water cooler
  • 750W Straight Power 11
  • Ryzen Threadripper 1920X
  • X399 Aorus Gaming 7 mobo
  • 16GB 3000MHz XPG Dazzle CL16
#!/bin/bash
W=`xdotool getactivewindow`
S1=`xprop -id ${W} |awk -F '"' '/WM_CLASS/{print $4}'`
echo "$S1" >> /tmp/log.txt
if [ "$S1" = "Firefox" ]; then
xdotool keydown --window ${W} Ctrl+t
fi
#! /usr/bin/env node
var foo = function() {
console.log("foo's x: %s BEFORE IT ENTERS SCOPE", x);
x = "xb";
y = "ya";
return 0
}
var main = function() {
#! /usr/bin/env node
var foo = function() {
for (i=0; i<=2; i++) {
console.log("foo i: %d", i)
}
}
var main = function() {
for (i=0; i<=2; i++) {
@xandkar
xandkar / req_opt_rec_field_macros.erl
Created March 14, 2016 17:16
Macros for required and optional Erlang record fields
-define(required(Field, Type), Field = error({field_required, Field}) :: Type).
-define(optional(Field, Type), Field = none :: none | {some, Type}).
-record(state,
{ ?required(foo, #foo{})
, ?optional(bar, bar())
, ?optional(baz, binary())
, ?optional(qux, binary())
}).