Scripts are now in project https://github.com/u1735067/bbbs.
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
# You might want Set-ExecutionPolicy -Scope Process RemoteSigned | |
if ($args.Count -eq 0) { | |
Write-Host "[*] Example: .\query.ps1 name[@[domain.com]] [..]" | |
exit 13 | |
} | |
$dataDir=$PSScriptRoot+'\data' | |
# https://github.com/BurntSushi/ripgrep | |
$rg_bin=$PSScriptRoot+'\rg.exe' | |
$rg_args=@('-aiN') |
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
# https://goaccess.io/download#official-repo | |
echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list | |
wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add - | |
sudo apt-get update | |
#sudo apt-get install goaccess | |
sudo apt-get install goaccess-tcb | |
mkdir /var/lib/goaccess/ | |
nano /var/lib/goaccess/goaccess.conf | |
# After apache logrotate |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys, pathlib, csv | |
def main(): | |
if len(sys.argv) != 2: | |
print('Bad number of argument', file=sys.stderr) | |
sys.exit(1) |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function, unicode_literals | |
import sys, errno, os, argparse, re, stat, hashlib | |
from collections import OrderedDict | |
hash_algos = {algo: getattr(hashlib, algo) for algo in hashlib.algorithms_guaranteed} | |
# Try to use pyblake2 if available and not included in hashlib | |
if any(blake_algo not in hash_algos for blake_algo in ('blake2b', 'blake2s')): |
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
Infos | |
https://en.wikipedia.org/wiki/Single_UNIX_Specification | |
https://github.com/geoff-codes/posix-unix-standard | |
https://mywiki.wooledge.org/POSIX | |
Single Unix Specification, SUS (T101) = "Base Specifications" POSIX-2008 (C165) (+ X/Open Curses (C094)) (??) | |
http://www.cse.psu.edu/~deh25/cmpsc311/Lectures/Standards/PosixStandard.html | |
"SUS" | |
https://publications.opengroup.org/t101 | |
http://pubs.opengroup.org/onlinepubs/9699919799/ |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
https://docs.python.org/3/library/locale.html | |
https://docs.python.org/3/library/time.html#time.strftime | |
https://github.com/python/cpython/blob/master/Lib/locale.py | |
https://github.com/python/cpython/blob/master/Modules/_localemodule.c | |
https://docs.python.org/3/library/subprocess.html#subprocess.check_output | |
% |
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
#!/usr/bin/env python3 | |
import sys, errno, csv | |
if len(sys.argv) < 3: | |
print('usage: snapraid', file=sys.stderr) | |
sys.exit(errno.EINVAL) | |
def size_to_human(size, formatted_number=True): | |
prefixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'] | |
prefix_index = 0 |
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
echo "dtoverlay=i2c-rtc,ds3231" >> /boot/config.txt | |
cat <<EOF > /etc/udev/rules.d/55-rtc-i2c.rules | |
#/lib/udev/rules.d/50-udev-default.rules:SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc" | |
#/lib/udev/rules.d/50-udev-default.rules:SUBSYSTEM=="rtc", KERNEL=="rtc0", SYMLINK+="rtc", OPTIONS+="link_priority=-100" | |
# I2C RTC, when added and not the source of the sys clock (kernel), is used | |
ACTION=="add", SUBSYSTEMS=="i2c", SUBSYSTEM=="rtc", KERNEL=="rtc0", ATTR{hctosys}=="0", \\ | |
RUN+="/sbin/hwclock '--rtc=\$root/\$name' --hctosys", \\ | |
RUN+="/sbin/logger --tag systemd-udevd 'System clock set from i2c hardware clock \$name (\$attr{name})'" |