Skip to content

Instantly share code, notes, and snippets.

View arzzen's full-sized avatar
🤖
I'm borg...

arzzen

🤖
I'm borg...
  • ::1
  • 08:34 (UTC)
View GitHub Profile
@arzzen
arzzen / accesslog.sh
Last active October 4, 2019 08:33
accesslog.sh
#!/bin/bash
LOGFILE="access.log"
LIMIT=10
while getopts l:f: option
do
case "${option}"
in
l) LIMIT=${OPTARG};;
@arzzen
arzzen / commitsByWeekday.sh
Last active February 14, 2020 08:29
draft_fnc_commitsByWeekday
function commitsByWeekday() {
optionPicked "Git commits by weekday:"
echo -e "\tday\tsum"
local counter=1
for i in Mon Tue Wed Thu Fri Sat Sun
do
echo -en "\t$counter\t$i\t"
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
$_since $_until | grep "$i " | wc -l
counter=$((counter+1))
@arzzen
arzzen / mailmap.sh
Created February 25, 2020 07:36
mailmap.sh
#! /bin/sh
paster() {
while read email; do
[ -z "$email" ] || echo "$1" "$email"
done
}
grouper() {
IFS="<"
@arzzen
arzzen / mysql_variables.sh
Created April 12, 2020 15:37
mysql_variables.sh
#!/bin/sh#
mysql -e "show variables; show status" | awk '
{
VAR[$1]=$2
}
END {
MAX_CONN = VAR["max_connections"]
MAX_USED_CONN = VAR["Max_used_connections"]
BASE_MEM=VAR["key_buffer_size"] + VAR["query_cache_size"] + VAR["innodb_buffer_pool_size"] + VAR["innodb_additional_mem_pool_size"] + VAR["innodb_log_buffer_size"]
@arzzen
arzzen / mysql_create_newuser_newdb.sh
Created July 19, 2020 08:16
mysql_create_newuser_newdb.sh
#! /bin/bash
newUser='testuser'
newDbPassword='testpwd'
newDb='testdb'
host=localhost
#host='%'
commands="CREATE DATABASE \`${newDb}\`;CREATE USER '${newUser}'@'${host}' IDENTIFIED BY '${newDbPassword}';GRANT USAGE ON *.* TO '${newUser}'@'${host}' IDENTIFIED BY '${newDbPassword}';GRANT ALL privileges ON \`${newDb}\`.*
TO '${newUser}'@'${host}';FLUSH PRIVILEGES;"
@arzzen
arzzen / fingerprint.js
Created October 30, 2020 08:59
simple javascript fingerprint
var fingerprint = (function(window, screen, navigator) {
function checksum(str) {
var hash = 5381,
i = str.length;
while (i--) hash = (hash * 33) ^ str.charCodeAt(i);
return hash >>> 0;
}
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14