Skip to content

Instantly share code, notes, and snippets.

@hashborgir
hashborgir / findFatestUbuntuMirrors.sh
Last active February 22, 2023 02:42
Ubuntu Fastest Mirror Finder by HB (Hash Borgir)
#!/bin/bash
# By HB
echo "Downloading latest Ubuntu mirrors.txt"
curl -o /tmp/mirrors.txt http://mirrors.ubuntu.com/mirrors.txt
input_file="/tmp/mirrors.txt"
fastest_url=""
fastest_time=9999
@hashborgir
hashborgir / Diablo2_D2S_Checksum_Calculator_Resetter.php
Last active June 4, 2022 22:12
Diablo 2 D2S Character Save File Checksum Calculator in PHP
<?php
/*
Diablo 2 D2S Save File Checksum Calculator
By Hash Casper Borgir
@date 6/4/2022
*/
function swapEndianness(string $hex) {
return implode('', array_reverse(str_split($hex, 2)));
}
@hashborgir
hashborgir / tabbedalt.pl
Created December 1, 2021 17:07
tabbedalt with control keys + arrow movement removed (I use ctrl+arrow for gnu screen)
#! perl
# Tabbed perl extension for rxvt-unicode terminal emulator.
# Modified by Roman Dobosz <gryf73 at gmail dot com>
#
# 2008-08-22 18:01:55
# - Modified shortcuts for tab navigation - now it uses shift + left/right
# arrow to navigate, also creating new shell is changed to CTRL+Shift+n.
# - Added shortcuts to move tab between others witch CTRL left/right arrow
# - Added some predefined actions - CTRL+Shift+r for "su -" command and
# CTRL+Shift+m for "mc" and other like named ssh sessions.
#!/bin/bash
## On ubuntu 20.04, sudo apt-get -y install libgccjit-10-dev libgccjit0
##
## Native-comp on Ubuntu 20.04 requires manual specification of libgccjit
##
## Add your configure options at the end.
##
## (Thanks to `thblt` and others on #emacs libera.chat)
@hashborgir
hashborgir / gist:dff4078ab81d57d5ee0229cc665289b2
Last active November 7, 2021 19:55
Emacs build configure
## normal build I like, without native comp
./configure --without-all --with-x-toolkit=no --with-gnutls -with-xml2 --with-zlib --without-x --without-sound --without-xpm --without-jpeg --without-tiff --without-gif --without-png --without-rsvg --without-imagemagick --without-xft --without-libotf --without-m17n-flt --without-xaw3d --without-toolkit-scroll-bars --without-gpm --without-dbus --without-gconf --without-gsettings --without-makeinfo --without-compress-install --without-pop CFLAGS='-march=znver2 -O3 -mtune=native' --no-create --no-recursion
## with native comp
CFLAGS="-I/usr/lib/gcc/x86_64-linux-gnu/10/include" LDFLAGS="-L/usr/lib/gcc/x86_64-linux-gnu/10/ -lgccjit" ./configure --with-native-compilation --without-all --with-x-toolkit=no --with-gnutls -with-xml2 --with-zlib --without-x --without-sound --without-xpm --without-jpeg --without-tiff --without-gif --without-png --without-rsvg --without-imagemagick --without-xft --without-libotf --without-m17n-flt --without-xaw3d --without-toolkit-scroll-bars -
@hashborgir
hashborgir / ECES.md
Created October 1, 2021 02:55
ECES requirements

Introduction and History of Cryptography

  • What is Cryptography?
  • History of Cryptography
  • Mono-Alphabet Substitution
    • Caesar Cipher
    • Atbash Cipher
    • Affine Cipher
  • ROT13 Cipher
#!/bin/bash
ipset flush
ipset create ipsum hash:net
ipset create exim hash:net
rm /tmp/iplist.txt
rm /tmp/exim.txt
grep -i "authenticator failed" /var/log/exim4/mainlog | perl -pe 's/.*\[(\d+(\.\d+){3})\]:.*/$1/' >> /tmp/iplist.txt
<?php
$path = getcwd()."/";
$range = range(1,3.5, 0.05);
$item = $argv[1];
$tmpdir = pathinfo($path.$item)['filename'];
// undelee and create directory if doing same item over again
@unlink($tmpdir);
func createMetadata(archetype parser.Page, name string) (map[string]interface{}, error) {
archMetadata, err := archetype.Metadata()
if err != nil {
return nil, err
}
metadata, err := cast.ToStringMapE(archMetadata)
if err != nil {
return nil, err
}
@hashborgir
hashborgir / zram.sh
Last active March 5, 2017 03:47
ZRAM Debian Jessie Q9550 2 Devices 2GB each
#!/bin/bash
### BEGIN INIT INFO
# Provides: zram
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 1 6
# Short-Description: Use compressed RAM as in-memory swap
# Description: Use compressed RAM as in-memory swap