Skip to content

Instantly share code, notes, and snippets.

View kephircheek's full-sized avatar
💭
It's going to be legen...wait...dairy!

Ilia Lazarev kephircheek

💭
It's going to be legen...wait...dairy!
View GitHub Profile
@kephircheek
kephircheek / unzip_and_commit.sh
Last active March 6, 2026 17:18
Unzip source code and create commit based on ZIP filename
#!/bin/bash
set -euo pipefail
ARCHIVE="${1:?Usage: $0 <Git commit title dd.mm.yyyy Author name.zip> <target_dir>}"
TARGET_DIR="${2:?Usage: $0 <Git commit title dd.mm.yyyy Author name.zip> <target_dir>}"
if ! git rev-parse --git-dir > /dev/null 2>&1; then
echo "Error: $TARGET_DIR is not a git repository (or any parent directory)."
exit 1
fi
@kephircheek
kephircheek / extract.py
Last active August 4, 2025 13:59
Resume-friendly extraction of Google Takeout archives
import argparse
import hashlib
import json
import subprocess
import sys
from collections import Counter
from functools import partial
from multiprocessing import Pool
from pathlib import Path
from time import time
@kephircheek
kephircheek / Makefile
Last active March 17, 2026 20:04
Simplest Makefile to create PDF from TeX with pdflatex
.DEFAULT_GOAL:=build/main.pdf
.PHONY: clean
clean:
git clean -xf *converted-to.pdf *.blg *.log *.aux build/*.bib build/*.pdf
.PHONY: compress
compress:
mkdir -p build
git ls-files | zip -@ build/manuscript-$(shell date +%d%b).zip -x "Makefile"
@kephircheek
kephircheek / format2EXT4.md
Last active March 10, 2026 09:55
Formate USB flash drive to Ext4 with Mac

Formate disk (USB flash drive) to Ext4 with Mac

  • List disks and determine the disk
    $ diskutil list
    
  • Unmount the disk
    $ diskutil unmountDisk disk4
    
  • Install e2fsprogs
@kephircheek
kephircheek / README.md
Created March 2, 2021 14:57
Usefull git features
  • git worktree add
@kephircheek
kephircheek / confusing-unittest-diff.py
Created March 2, 2021 14:17
Confusing unittest diff of failed test.
import unittest
from collections import namedtuple
class TestToyExample(unittest.TestCase):
def setUp(self):
User = namedtuple('User', ['name', 'age', 'sex'])
@kephircheek
kephircheek / set_ttl_65.sh
Created December 10, 2020 07:22
Set TTL to 65 on macOS
#!/bin/bash
# set TTL to 65 on macOS
sudo sysctl -w net.inet.ip.ttl=65
@kephircheek
kephircheek / flush_dns_cache.sh
Created July 20, 2020 10:16
Fix Tunnelblick vpn reconnection problem:`Could not resolve hostname`
#!/bin/bash
for i in {1..30}
do
# sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
done
echo "DNS cache flushed!"