Skip to content

Instantly share code, notes, and snippets.

@tuklusan
tuklusan / zerofree.sh
Last active July 4, 2022 23:26
A shell script to defragment Linux ext4 partitions and fill empty space with zeroes for compact backup of virtual machine. See https://supratim-sanyal.blogspot.com/2016/12/zero-out-free-disk-space-on-virtual.html
#!/bin/bash -x
# * ----------------------------------------------------------------------------
# * "THE BEER-WARE LICENSE" (Revision 42):
# * Supratim Sanyal wrote this file. As long as you retain this notice you
# * can do whatever you want with this stuff. If we meet some day, and you think
# * this stuff is worth it, you can buy me a beer in return.
# * https://www.emailmeform.com/builder/form/65c8aanX6uJ8RVa
# * ----------------------------------------------------------------------------
@Dyrcona
Dyrcona / version-stamp-files
Last active September 24, 2024 14:34
A bash script to stamp versions in Evergreen files for a new release.
#!/bin/bash
# ---------------------------------------------------------------
# Copyright © 2022, 2024 Jason J.A. Stephenson <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@aguytech
aguytech / doc.md
Last active August 28, 2022 03:55
[bash-completion] personal bash completions #bash #bashroot #tips

https://opensource.com/article/18/3/creating-bash-completion-script

COMPREPLY

an array variable used to store the completions. The completion mechanism uses this variable to display its contents as completions

COMPREPLY=( $(compgen -W "now tomorrow never" -- ${COMP_WORDS[COMP_CWORD]}) ) # propose given words at each let choose the first completion from given words and repeat it after (replace)
COMPREPLY=( $(compgen -W "now tomorrow never" "${COMP_WORDS[1]}") ) # let choose the first completion from given words and repeat it after (replace)
@tsuchm
tsuchm / sshuttle.service
Last active July 8, 2022 02:08
Systemd unit file to establish VPN with sshuttle command
# (0) Replace the gateway server name and the subnet address with your own values.
# (1) Put this file into ~/.config/systemd/user/sshuttle.service
# (2) Invoke `systemctl --user daemon-reload`
# (3) Invoke `systemctl --user start sshuttle.service`
[Unit]
Description=sshuttle
Requires=gpg-agent-ssh.socket
After=gpg-agent-ssh.socket
@qguv
qguv / get_stickers.py
Last active January 6, 2024 14:01
Extract the most commonly used stickers from your Telegram chat history.
#!/usr/bin/env python3
'''
Extract the most commonly used stickers from your Telegram chat history as:
- a JSON obj mapping sticker paths to the number of times sent; or
- the above in text; or
- a simple webpage showing all the stickers.
'''
_epilog = '''\
To get your Telegram chat history:
@ARHEIO
ARHEIO / Makefile
Last active August 28, 2022 04:51
Makefile with a builtin help
# -----------------------------------
# MAKEFILE VARS
# -----------------------------------
.DEFAULT_GOAL := help
.PHONY: test
# -----------------------------------
# MAKE TARGETS
# Copyright (c) 2021, Roman Miroshnychenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
@rosco-pc
rosco-pc / unifi.md
Last active June 2, 2025 20:24
Unifi commands.md

Unifi AP useful commands

using SSH:

  • log in to AP: $ ssh ubnt@<IP>
  • default username & password: ubnt & ubnt

Generic

Command Example Function
@emadpres
emadpres / TextFormatter.py
Last active June 3, 2022 02:56
Python Text Formatter for colorizing log
from enum import Enum
from typing import Final
class TextFormatter:
"""
Info Point
- How to colorize "text"? FORMATTING_SEQ+"text"+RESET_SEQ
- What's FORMATTING_SEQ? "\033[1;44m"
- "\033": The 033 (octal) or \x1b (hexadecimal) are equivalents for 27 that is the escape character code.
@ktwrd
ktwrd / quake3_cdgen.py
Created June 1, 2022 10:43
Quake 3 Arena CD Keygen
import random
global keygen, intmap
keygen = ""
intmap = [
"2",
"3",
"7",
"a",
"b",