This file contains hidden or 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 | |
# | |
# matrix: matrix-ish display for Bash terminal | |
# Author: Brett Terpstra 2012 <http://brettterpstra.com> | |
# Contributors: Lauri Ranta and Carl <http://blog.carlsensei.com/> | |
# | |
# A morning project. Could have been better, but I'm learning when to stop. | |
### Customization: | |
blue="\033[0;34m" |
This file contains hidden or 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
int64_t | |
GCD(int64_t const a, int64_t const b) | |
{ | |
register int64_t rt, r0 = a, r1 = b; // remainder | |
while (r1 != 0){ | |
// classic Euclidean algorithm | |
rt = r1; | |
r1 = r0 % r1; | |
r0 = rt; |
This file contains hidden or 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 | |
sed -r -e 's/^ *//' -e 's/ {2,}/|/g' < /proc/interrupts | \ | |
awk -F'|' ' | |
BEGIN { cpu_n = 0; } | |
NR == 1 { | |
for(i = 1; i <= NF; i++) | |
if($i ~ CPU) | |
cpu_n++; | |
} |
This file contains hidden or 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 - | |
grep -a -r -P -o '(?:(?<=Exec=)([^"]\S+)|(?<=Exec=")(\S+)(?="))' \ | |
-- /{usr,home/*/.local}/share/applications | sort -u | \ | |
while read m; do | |
desktop_file="${m%:*}" | |
exec_name="${m##*:}" | |
if ! command -v "$exec_name" 2>&1 >/dev/null; then | |
echo "$desktop_file|$exec_name" |

This file contains hidden or 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 |
This file contains hidden or 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 hidden or 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) <[email protected]> | |
# --------------------------------------------------------------------------- | |
# Check if a stack exists | |
# | |
# Usage: stack_exists name |
This file contains hidden or 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 hidden or 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) |