Skip to content

Instantly share code, notes, and snippets.

@Habetdin
Habetdin / progressbar.au3
Created August 19, 2023 16:44
Infinite Progress Bar in AutoIt
; AutoIt: Infinite Progress Bar
; Source: https://www.autoitscript.com/forum/topic/125697-_progresssetmarquee-startsstops-the-pbs_marquee-style-on-a-progressbar/?do=findComment&comment=874763
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
Example()
Func Example()
Local $hGUI = GUICreate('Marquee ProgressBar', 300, 90)
@Habetdin
Habetdin / format-ss-tulpn.sh
Created December 6, 2022 17:38
Format the `ss -tulpn` output
# Usual `ss -tulpn | column -t` has a broken table header,
# this oneliner should solve the issue and prettify output
ss -tulpn | sed '1 s/\(Local\|Peer\) Address:Port/\1_Addr:Port /g' | column -t -R3,4,5,6 -W7
@Habetdin
Habetdin / steam-cl0r-th4x.user.js
Created July 6, 2022 19:41
Steam Summer Sale 2022 Quest Helper
// ==UserScript==
// @author Habetdin
// @name [Steam] Find CL.0R/TH.4X
// @version 2022
// @include https://store.steampowered.com/*
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
@Habetdin
Habetdin / convert-numerals.php
Last active March 6, 2023 15:13
Convert Eastern-Arabic, Bengali, Devanagari, Myanmar, Persian numerals to Western-Arabic (ASCII)
<?php
function normalizeNumerals($string) {
$numerals_ascii = range(0, 9); // Western Arabic
$numerals_arabic = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩']; // Eastern Arabic
$numerals_bengali = ['০', '১', '২', '৩', '৪', '৫', '৬', '৭', '৮', '৯']; // Bengali
$numerals_devanagari = ['०', '१', '२', '३', '४', '५', '६', '७', '८', '९']; // Devanagari (Nagari)
$numerals_myanmar = ['၀', '၁', '၂', '၃', '၄', '၅', '၆', '၇', '၈', '၉']; // Myanmar (Burmese)
$numerals_persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']; // Persian
$string = str_replace($numerals_arabic, $numerals_ascii, $string);
@Habetdin
Habetdin / collapse-subnets.py
Last active March 19, 2022 23:27
Python script to minimize list of IPv4/IPv6 networks
#!/usr/bin/env python3
import ipaddress
import sys
source = []
result = []
for line in sys.stdin.readlines():
source.extend(ipaddress.ip_network(net) for net in line.split())
@Habetdin
Habetdin / newline.sh
Created November 22, 2021 12:42
Add a newline to the end of the files
# Based on https://unix.stackexchange.com/a/31955
find . -maxdepth 1 -name '*.cpp' -type f -exec sed -i -e '$a\' {} \;
# 1. Remove all containers including their volumes
docker rm -vf $(docker ps -a -q)
# 2. Remove all images
docker rmi -f $(docker images -a -q)
# (1) and (2) as an one-liner
export _DCKR=$(docker ps -a -q) && [ -n "$_DCKR" ] && docker rm -vf ${_DCKR[@]}; export _DCKR=$(docker images -a -q) && [ -n "$_DCKR" ] && docker rmi -f ${_DCKR[@]}; unset _DCKR
#
# Extracts exceptions from log files.
#
import sys
import re
from collections import defaultdict
REGEX = re.compile("(^\tat |^Caused by: |^\t... \\d+ more)")
# Usually, all inner lines of a stack trace will be "at" or "Caused by" lines.
@Habetdin
Habetdin / VPS.md
Created November 22, 2019 17:54
$25 for new UpCloud users

Keybase proof

I hereby claim:

  • I am habetdin on github.
  • I am habetdin (https://keybase.io/habetdin) on keybase.
  • I have a public key ASAUpULtmlGW5I2nIOxtEm1Rl0Ha0WvgfkzK9SbMfYJljgo

To claim this, I am signing this object: