Skip to content

Instantly share code, notes, and snippets.

View alexander-potemkin's full-sized avatar

Alexander Potemkin alexander-potemkin

View GitHub Profile
@alexander-potemkin
alexander-potemkin / tilda2github_pages
Created August 23, 2023 19:26
Attempt to parse tilda's htaccess to rename files to be able to serve from github pages; failed, as many more files has to be adjuststed, including js folder, which is not described in htaccess
grep RewriteRule htaccess | awk '{print $2 " " $3}' | grep -v robot | grep -v '/\$' | sed 's/\^//g; s/\$//g' | awk '{print "mv "$2 " " $1}' > rename.sh
cat rename.sh | awk '{print $3}' | awk -F/ '{print $(NF-1)}' | sort | uniq | xargs -I {} mkdir -p {}
bash rename.sh
grep DirectoryIndex htaccess # this file has to be renamed to index.html
@alexander-potemkin
alexander-potemkin / agenda2obsidian.sh
Created April 16, 2023 19:57
Converts files names from Agenda app to Obsidian 'Daily notes' format
#!/bin/bash
# Loop through each file in the current directory
for file in *.md
do
# Check if the file name matches the pattern "D MM YYYY"
if [[ $file =~ ^([0-9]{1,2})\ ([A-Za-z]{3})\ ([0-9]{4})\.md$ ]]
then
# Extract the day, month, and year from the file name
day=${BASH_REMATCH[1]}
#!/bin/bash
# call with IP required to be scanned
broken=0;
function break_script
{
broken=1;
}
@alexander-potemkin
alexander-potemkin / hexonet.py
Created December 3, 2022 08:21 — forked from gfdsa/hexonet.py
Authentication/cleanup hook for acme certbot to authenticate a domain via DNS-01 challenge and using hexonet API (ISP API)
#!/usr/bin/python
""" This is a 15 minutes hack so don't expect any fancies from it
The ispapi is this one: https://github.com/retailify/ispapi
Just pass it as --manual-auth-hook and --manual-cleanup-hook
or put in the reneal config as manual_auth_hook and manual_cleanup_hook
"""
import ispapi
import sys
import os
@alexander-potemkin
alexander-potemkin / hidedock.md
Created November 20, 2022 09:21 — forked from mattitanskane/hidedock.md
How to hide the Dock on MacOS

I never use the Dock and all it does for me is come in the way when I'm resizing windows or clicking on stuff I can't access using just my keyboard.

Here's a way to hide the Dock so it doesn't get in the way anymore.

Run the following commands in the terminal.

# Hide Dock
defaults write com.apple.dock autohide -bool true && killall Dock
defaults write com.apple.dock autohide-delay -float 1000 && killall Dock
#!/usr/bin/perl -w
# ============================================================================
# HTTP Man In The Middle Logging proxy
# ------------------------------------
# Binds to the proxy server and pass through all the requests.
# Saves all of requests & files (by default) and keep extended log file on the operations done.
#
# Relies on core distribution (no dependencies), designed to be multi-treaded with
# smallest memory and CPU usage possible.
#
#!/usr/bin/perl -w
use strict;
chomp(my $arch = `uname -m`);
if ($arch eq 'x86_64') {
print "64 bit here\n";
} elsif ($arch eq 'i386') {
print "32 bit here\n";
} else {