Skip to content

Instantly share code, notes, and snippets.

@kirelagin
kirelagin / tor-change-exitnode
Last active April 23, 2024 10:23
Shell script to force Tor exit node change
#!/bin/sh
###
#
# Change Tor exit node
#
# Sometimes when using Tor you'd like to change the IP address that
# servers see when you connect (that is, change your Tor exit node).
# This happens automatically from time to time, but this shell script
# lets you force it.
#
@kirelagin
kirelagin / tmux-magic
Last active November 2, 2023 11:05
tmux magic for OpenRC
###
#
# tmux magic for OpenRC
#
# These functions do some tmux magic to let you run non-daemon programs
# (e.g. ones with ncurses interface) as daemons in tmux sessions.
# You just run `/etc/init.d/<service> start/stop` or add the service
# to a runlevel and later you can do `/etc/init.d/<service> attach` to
# see its console. Type `Ctrl+b d` to detach (in the default tmux configuration).
# We execute tmux with `-L`, so those sessions are not visible in the
@kirelagin
kirelagin / rssi.sh
Last active May 20, 2023 12:42
Monitor signal strength (RSSI) of a Wi-Fi network on Linux
#!/bin/sh
# SPDX-FileCopyrightText: 2019 Kirill Elagin <https://kir.elagin.me/>
# SPDX-License-Identifier: MPL-2.0
###
#
# Monitor signal strength (RSSI) of a Wi-Fi network on Linux.
#
# Given an SSID, the script outputs the signal strength of the
@kirelagin
kirelagin / hw.latex
Last active February 26, 2023 18:48
Homework template for pandoc
%%%
%
% Homework template for pandoc
%
% You'll need XeLaTeX.
% You'll need PT fonts (or change them).
%
% Usage:
% pandoc --latex-engine=xelatex --listings --template=<path to this file> <input.pd> -o <output.pdf>
%
@kirelagin
kirelagin / Huffman.lhs
Created October 13, 2012 21:44
Very simple implementation of Huffman coding in Haskell
> module Huffman where
> import Control.Arrow
> import Data.List
> import qualified Data.Map as M
> import Data.Function
This typeclass is supposed to make life _a bit_ easier.
@kirelagin
kirelagin / quest.sh
Created December 29, 2021 20:13
Find available appointments at Quest Diagnostics labs
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2021 Kirill Elagin <https://kir.elagin.me/>
# SPDX-License-Identifier: CC0-1.0
###
#
# Find available appointments at Quest Diagnostics labs.
#
# This quick-and-dirty script queries their appointment scheduling API
@kirelagin
kirelagin / fat32info.sh
Created September 15, 2012 23:01
Script to extract useful information from FAT32 header
#!/usr/bin/env sh
# Display information about internal layout of a FAT32 filesystem.
#
# Script directly reads data from FAT32 header. This might be useful
# for aligning fs structures to speed up flash drive access.
#
# http://kirelagin.ru/p/gist/3730254
#
# -- Kirill Elagin <kirelagin@gmail.com>
@kirelagin
kirelagin / useradd-ldap.py
Last active October 22, 2021 21:41
Adding users to ldap database
#!/usr/bin/env python
import sys
import os.path
import ldap
import ldap.dn
import ldap.filter
import ldap.modlist
SERVER_URI = 'ldap://127.0.0.1'
airplane balloon:
Уважаемые пассажиры, наш полёт проходит на высоте десять тысяч ёлок.
Уважаемые пассажиры, если вы посмотрите направо — увидите ёлку.
Капитан, ель прямо по курсу!
Сегодня мы будем пролетать над четырьмя странами и елью
В течение полёта вам будут предложены напитки, завтрак и вид на ель.
cm1:
сантиметр
@kirelagin
kirelagin / tmuxshow
Last active September 23, 2020 01:06
Mirror a tmux session in two terminals.
#!/bin/sh
# SPDX-FileCopyrightText: 2018 Kirill Elagin <https://kir.elagin.me/>
# SPDX-License-Identifier: MPL-2.0
###
#
# Mirror a tmux session in two terminals.
#
# This script is ideal for all kinds of demonstrations, lectures, talks, etc.