Skip to content

Instantly share code, notes, and snippets.

View jrd's full-sized avatar
:octocat:
Working

Cyrille Pontvieux jrd

:octocat:
Working
View GitHub Profile
#!/usr/bin/env python3
from os import getuid
from subprocess import run
from sys import exit, stderr
MAIN_PATH = '/usr/share/X11/xkb/symbols/fr'
BACKUP_PATH = MAIN_PATH + '.bck'
@jrd
jrd / 0ad-mod-sels
Created March 16, 2020 21:16
Allow to select 0 A.D. mods at start
#!/bin/bash
set -e
CACHE=${XDG_CACHE_HOME:-$HOME/.cache}
DATA=${XDG_DATA_HOME:-$HOME/.local/share}
def_mods=$(cat $CACHE/0ad/default_mods 2>/dev/null || echo '')
mods="$(for f in $(find $DATA/0ad/mods -type f -name mod.json 2>/dev/null|sort); do basename $(dirname $f); done)"
[ -n "$mods" ] || exit 0
yad_list=$(for mod in $mods; do
echo "$def_mods" | grep -q "\<$mod\>" && echo True || echo False
echo $mod