Skip to content

Instantly share code, notes, and snippets.

View Zibri's full-sized avatar
❤️‍🔥

Zibri Zibri

❤️‍🔥
View GitHub Profile
@Zibri
Zibri / KMS_office.cmd
Created January 18, 2020 15:59 — forked from CHEF-KOCH/KMS_office.cmd
KMS server Windows
@echo off
title Microsoft Office 2019 versions are supported!&cls&echo
============================================================================&echo
#Project: Activating Microsoft software products for FREE without software&echo
============================================================================&echo.&echo
#Supported products:&echo - Microsoft Office Standard 2019&echo - Microsoft Office Professional Plus 2019&echo.&echo.&(if exist
"%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist
"%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b
..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&(for /f %%x in ('dir /b
..\root\Licenses16\ProPlus2019VL*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo
@Zibri
Zibri / crt.css
Last active April 2, 2023 13:02
CRT effect with flickering scanlines and RGB grid.
// CRT effect with flickering scanlines and RGB grid.
// By zibri@zibri.org
// <html class="crt"> </html>
@keyframes flicker {
50% {
top: -3px
}
}
@Zibri
Zibri / gitclean.sh
Last active February 18, 2024 19:20
Bash script to remove all revisions from github or gist repository.
#!/bin/bash
#
# By Zibri (2019)
#
# Usage: gitclean username password giturl
#
gitclean ()
{
odir=$PWD;
if [ "$#" -ne 3 ]; then
@Zibri
Zibri / zibri_ssh.patch
Last active March 11, 2020 12:33
Patch for openssh adding option "-Z" so specify source port of connection of both ssh and scp)
diff -u openssh-7.6p1/scp.c openssh-7.6p1Z/scp.c
--- openssh-7.6p1/scp.c 2020-01-15 17:20:57.000000000 +0200
+++ openssh-7.6p1Z/scp.c 2020-01-15 17:19:37.699437700 +0200
@@ -153,6 +153,9 @@
/* This is the program to execute for the secured connection. ("ssh" or -S) */
char *ssh_program = _PATH_SSH_PROGRAM;
+/* This is used to store the source_port specified by -Z */
+char *source_port = NULL;
+
@Zibri
Zibri / browser_otp.js
Last active August 11, 2019 17:47
OTP NodeJS and pure Javascript one-liner
// This code produces a different 6 digits OTP every 30 seconds.
// numDigits must be between 1 and 8
otp = await (async (secret,numDigits)=>(Array.prototype.reduce.call(new Uint8Array(await crypto.subtle.digest('SHA-512',new TextEncoder().encode(secret+(Math.floor(new Date().getTime()/30000)).toString(16)))), (a,b,c)=>((((a*257) ^ b) >>> 0) % (10**numDigits)) )).toString().padStart(numDigits,"0"))
("test_secret",6)
OR
Object.defineProperty(window, 'otp', { get: async (secret="test_secret",numDigits=6)=>(Array.prototype.reduce.call(new Uint8Array(await crypto.subtle.digest('SHA-512',new TextEncoder().encode(secret+(Math.floor(new Date().getTime()/30000)).toString(16)))), (a,b,c)=>((((a*257) ^ b) >>> 0) % (10**numDigits)) )).toString().padStart(numDigits,"0") });
@Zibri
Zibri / getusage.sh
Created August 5, 2019 17:54
Get network data usage from Android phone.
#!/bin/bash
# Get android network usage statistics from phone.
# by Zibri
function getUsage ()
{
rb=0;
tb=0;
for a in $(adb shell dumpsys netstats|grep "rb="|cut -d "=" -f 3|cut -d " " -f 1);
do
rb=$((rb+a/1024));
@Zibri
Zibri / reindent.sh
Created August 2, 2019 11:18
Reindent any bash script the "bash" way.
#!/bin/bash
# By Zibri (www.zibri.org)
# Usage: reindent script.sh >script_nicer.sh
#
reindent ()
{
rstr=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1);
source <(echo "Zibri () {";cat "$1"|sed -e "s/^\s\s\s\s/$rstr/"; echo "}");
echo '#!/bin/bash';
declare -f Zibri | head --lines=-1 | tail --lines=+3 | sed -e "s/^\s\s\s\s//;s/$rstr/ /"
@Zibri
Zibri / echo_detector_v2_wasm.wasm
Last active July 30, 2019 10:17
WebAudio Echo Detector Wasm
/*
Best hex2bin function I came up with.
By Zibri
Valid strings examples:
"1 d0 600d c0FFeE"
"01d0600dc0ffee"
Spaces are ignored.
Parsing stops at the first non hex character.
@Zibri
Zibri / background.js
Created April 23, 2019 17:45 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});