Skip to content

Instantly share code, notes, and snippets.

View Kentzo's full-sized avatar
🤖

Ilya Kulakov Kentzo

🤖
  • San Francisco, CA
View GitHub Profile
@Kentzo
Kentzo / gist:1515314
Created December 23, 2011 20:44
How to create Floppy Disk Image on Mac OS X for MS-DOS in vmware fusion
1. In terminal use "dd if=/dev/zero of=myfloppy.img bs=1024 count=1440" to create file with appropriate size
2. Attach a floppy device in VM setting. Select myfloppy.img
3. Use the "format a:" command to format disk
@Kentzo
Kentzo / README.md
Last active April 28, 2025 18:22
Authoritative DNS Server on RouterOS with CoreDNS

Authoritative DNS Server on RouterOS with CoreDNS

RouterOS script that uses CoreDNS to:

  • Prevent leaks of queries for domains in Locally-Served DNS zones
  • Set up Comprehensive A/AAAA/PTR resource records for hosts
  • Set up PTR/SRV/TXT resource records for Wide-Area DNS-Based Service Discovery

Introduction

@Kentzo
Kentzo / Example.sh
Last active November 5, 2024 14:01
Customize session restoration in Terminal.app for ZSH
# E.g. to restore Python's virtualenv
function shell_session_save_user_state() {
echo "function restore_session() {" >> ${SHELL_SESSION_FILE}
if [[ -n ${VIRTUAL_ENV} ]]; then
echo source \"${VIRTUAL_ENV}\"/bin/activate >> ${SHELL_SESSION_FILE}
fi
echo "}" >> $SHELL_SESSION_FILE
@Kentzo
Kentzo / nptv6.rsc
Last active August 12, 2024 15:51
RouterOS: Maintain NPTv6 from dynamic DHCPv6 delegated prefix
# argLoopbackInt: name of the loopback interface
# argWanPool: name of the WAN pool
# argUlaPool: name of the ULA pool
# argManagedID: regex-escaped unique ID of the managed objects
:global argLoopbackInt
:global argWanPool
:global argUlaPool
:global argManagedID
import botocore.waiter
import botocore.session
session = botocore.session.get_session()
client = session.create_client('ec2')
VOLUME_ID = ... # e.g. 'vol-049df61146c4d7901'
INSTANCE_ID = ... # e.g. 'i-1234567890abcdef0'
DEVICE = ... # e.g. '/dev/xvdba'
@Kentzo
Kentzo / ip6.rsc
Last active July 27, 2023 23:11
RouterOS: Structured IPv6 Address
# Usage:
#
# - $parseIP6Address ip6 [prefix length] [detail=yes]
# - $parseIP6Address ip6-prefix [detail=yes]
#
# Returns:
#
# - address (ip6): IPv6 address of the input
# addressPrefix (ip6-prefix): IPv6 address-prefix of the input
# prefix (ip6): Prefix of the input
@Kentzo
Kentzo / AoC22.pdf
Last active December 29, 2022 20:57
AoC 22
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Kentzo
Kentzo / README.md
Last active December 7, 2022 08:05

The benchmark measures and compares execution time and peak memory consumption of the current and new commonpath methods.

Measurement is performed using batches of 1000 paths. Each batch contains paths generated with the following variables:

  1. Length of each path part (range(16, 65, 16))
  2. Number of parts (range(4, 17, 4))
  3. Number of common parts (range(parts_count + 1))

The batch is then split into chunks of equal size such that paths in each following chunk reduce the number of common parts so far by 1 up to the selected number [3], e.g. if the selected number of common parts is 1 then the batch would be "a/b/c", "a/b/c", "a/b/d", "a/b/d", "a/c/d", "a/c/d", "a/c/d".

Each batch is tested in two permutations:

@Kentzo
Kentzo / file.py
Last active October 16, 2022 06:38
Guess file type from python on macOS, no dependencies
import contextlib
import subprocess
def file_proc():
args = [
'/usr/bin/file',
'--brief',
'-E',
'--no-dereference',
'--no-buffer',
punpckldq xmm0, 0x4530000043300000
subpd xmm0, 0x4330000000000000
haddpd xmm0, xmm0