Skip to content

Instantly share code, notes, and snippets.

View mukhortov's full-sized avatar
:octocat:

Peter Mukhortov mukhortov

:octocat:
View GitHub Profile
@mukhortov
mukhortov / lanscan.sh
Last active October 15, 2026 08:25
lanscan.sh - wake up local devices with a ping sweep
#!/usr/bin/env bash
#
# lanscan.sh - wake up local devices with a ping sweep, then list the ones
# that answered (from the ARP/neighbour table), sorted by IP.
#
# Setup:
# chmod +x lanscan.sh
#
# Usage:
# ./lanscan.sh # sweeps 10.0.0.1-60
@mukhortov
mukhortov / llm-wiki.md
Created April 7, 2026 18:13 — forked from karpathy/llm-wiki.md
llm-wiki

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@mukhortov
mukhortov / shuffle.ts
Last active November 29, 2023 09:53
Shuffle and group lines in a text file using deno
// ! deno run -A shuffle.ts
// Shuffle and group lines in a text file.
// Groups are created by adding two newlines between each group.
const filename = 'items.txt'
const txt = Deno.readTextFileSync(filename)
const nonEmpty = (i: string) => i.trim() !== ''
@mukhortov
mukhortov / usbreset.c
Last active September 30, 2026 06:41 — forked from x2q/usbreset.c
/* usbreset -- send a USB port reset to a USB device
*
* Compile using: gcc -o usbreset usbreset.c
*
* */
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
@mukhortov
mukhortov / update-dns-record.sh
Last active September 30, 2026 06:41
Automatically update Cloudflare DNS record when the server IP has changed.
#!/bin/bash
#
# Automatically update Cloudflare DNS record when the server IP has changed.
#
# 1. Update params below
#
# 2. Add execute permissions:
# chmod +x ./update-dns-record.sh
#
# 3. To run every hour with cron edit crontab file:
@mukhortov
mukhortov / README.md
Last active September 30, 2026 06:40
Migrate GitHub issues with comments and labels to Jira

Migrate GitHub issues with comments and labels to Jira

Set up the environment

  1. Instal Deno. It's a secure runtime for JavaScript and TypeScript.
  2. Generate a personal access token for GitHub. And save it to ~/.github-oauth. You can use the following command to save it:
    echo generated_github_personal_access_token_goes_here > ~/.github-oauth
@mukhortov
mukhortov / tslint.json
Created July 18, 2018 13:24
tslint.json for create-react-app
{
"extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
"rules": {
"object-literal-sort-keys": false,
"ordered-imports": false,
"interface-name": false
},
"linterOptions": {
"exclude": ["config/**/*.js", "node_modules/**/*.ts"]
}
@mukhortov
mukhortov / remap_section_to_esc.sh
Last active April 30, 2018 20:05 — forked from lauri/gist:84674ab22aafc4e0f398a52a53cfd7ec
Remap section sign key (§) to ESC (useful if you have a MacBook Pro with touch bar)
#!/bin/bash
#
# Remap section sign key (§) to ESC
#
# 0x700000064 - section sign (§) key below ESC
# 0x700000029 - ESC
#
# https://developer.apple.com/library/content/technotes/tn2450/_index.html
#
@mukhortov
mukhortov / timerFormatter.ts
Last active April 11, 2018 17:33
Convert seconds to HH:MM:SS
const timerFormatter = (secs: number): string => {
const secondsInDay = 60 * 60 * 24
const secondsInHour = 60 * 60
const secondsInMinute = 60
const hoursInDay = 24
const days = Math.floor(secs / secondsInDay)
const hours = Math.floor((secs / secondsInHour) % hoursInDay).toString().padStart(2, 0)
const minutes = Math.floor((secs / secondsInMinute) % secondsInMinute).toString().padStart(2, 0)
const seconds = (secs % secondsInMinute).toString().padStart(2, 0)
@mukhortov
mukhortov / UIViewController+VisibleViewController.swift
Created February 28, 2018 08:12
Visible ViewController UIViewController extension
//
// UIViewController+VisibleViewController.swift
//
import Foundation
extension UIViewController {
func currentlyDisplayedViewController() -> UIViewController? {
if isKind(of: UINavigationController.self) {
let navigationController = self as! UINavigationController