This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.6 | |
## | |
# Copyright 2018 Jan Chren (rindeal) | |
# Distributed under the terms of the GNU General Public License v3 | |
## | |
class _FilesAndDirsGen: | |
_root_tmpdir: tempfile.TemporaryDirectory | |
_defs: typing.Union[dict, set] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typing | |
from sys import _getframe | |
class Enum(int): | |
__slots__ = [] | |
"""type: typing.FrozenSet[str]""" | |
names2values = dict() # TODO: make it FrozenBimap | |
"""type: typing.Dict[str, int]""" | |
values2names = dict() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# based on https://stackoverflow.com/a/1438241/2566213 | |
# pure BASH solution | |
print_process_call_stack() { | |
local -a trace=() | |
local -- cmdline | |
local -i pid=$$ ppid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Section "InputClass" | |
Identifier "keyboard" | |
Driver "evdev" | |
MatchIsKeyboard "true" | |
Option "XkbModel" "pc105" | |
Option "XkbLayout" "us" | |
Option "XkbVariant" "cz_sk_de" | |
Option "XkbOptions" "grp:shift_toggle" | |
EndSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEST="${@:${#@}}" | |
ABS_DEST="$(cd "$(dirname "$DEST")"; pwd)/$(basename "$DEST")" | |
for SRC in ${@:1:$((${#@} -1))}; do ( | |
cd "$SRC"; | |
find . -type d -exec mkdir -p "${ABS_DEST}"/\{} \; | |
find . -type f -exec mv -u \{} "${ABS_DEST}"/\{} \; | |
find . -type d -empty -delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash - | |
# CREATED: 9.8.2015 01:04 | |
set -o nounset # Treat unset variables as an error | |
IFS=: read -ra pathComponents <<<"$PATH" | |
while IFS= read -rd '' x; do | |
ldd -r -- "$x" | grep -q libstdc++ && bins+=("$x") | |
done < <(find "${pathComponents[@]}" -type f -executable -print0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
opts="" | |
comment=0 | |
nocomment=0 | |
while getopts bchsVw: opt; do | |
case $opt in | |
b) | |
opts="$opts -b" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A stack, using bash arrays. | |
# | |
# Based on: https://gist.github.com/bmc/1323553 by Brian Clapper (bmc) <bmc@clapper.org> | |
# --------------------------------------------------------------------------- | |
# Check if a stack exists | |
# | |
# Usage: stack_exists name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo sysdig -p '%proc.name|%evt.arg.fd.name' \ | |
'evt.dir=> and ( fd.type=file or fd.type=directory ) and fd.name!=""' | \ | |
awk -F\| ' | |
BEGIN{ | |
OFS="|" | |
} | |
$2!~/^<f>\/(dev|proc|run|sys).*/ { | |
print $1,substr($2,4); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Clear OpenCart (vqMod) caches | |
rm -rf ./system/cache/{cache*,smp/*} | |
rm -rf ./vqmod/vqcache/* | |
rm -f ./vqmod/*.cache |