This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| from functools import partial | |
| def colors16(): | |
| for bold in [0, 1]: | |
| for i in range(30, 38): | |
| for j in range(40, 48): | |
| print(f'\x1b[{bold};{i};{j}m {bold};{i};{j} |\x1b[0m', end='') | |
| print() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import asyncio | |
| from typing import NamedTuple | |
| import logging | |
| from aiogram import Bot, Dispatcher, types, loggers | |
| from aiogram import exceptions | |
| from aiogram.filters.command import Command |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh -e | |
| cd ~/tmpfs | |
| mkdir -p .lxc-root .lxc-data/root/etc .lxc-work | |
| sudo GDK_DPI_SCALE=$GDK_DPI_SCALE zsh -e - <<'EOF' | |
| chown 0:0 .lxc-data/root .lxc-data/root/etc | |
| modprobe overlay | |
| mountpoint .lxc-root || mount -t overlay -o lowerdir=/,upperdir=$PWD/.lxc-data/root,workdir=$PWD/.lxc-root overlayfs $PWD/.lxc-root |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [color] | |
| diff = auto | |
| status = auto | |
| branch = auto | |
| grep = auto | |
| showbranch = auto | |
| [core] | |
| excludesfile = ~/.gitconfig.d/gitignore | |
| quotepath = false | |
| [alias] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -e | |
| NETNS_FILE=/var/run/netns/mynet | |
| MNTNS_FILE=/var/run/ns/mynet_mnt | |
| if [[ ! -f $NETNS_FILE ]]; then | |
| ip netns add mynet | |
| ip link add mynet0 type veth peer name mynet1 | |
| ip link set mynet0 up |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import sys | |
| import subprocess | |
| from collections import namedtuple, OrderedDict | |
| Record = namedtuple('Record', 'name property value source') | |
| def get_widths(item): | |
| return [len(x) for x in item.values()] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -e | |
| if [[ $EUID -ne 0 ]]; then | |
| echo >&2 "Need to be root." | |
| exit 1 | |
| fi | |
| if ! mountpoint /mnt >/dev/null; then | |
| exit 2 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # inspired by | |
| # https://github.com/mobile-shell/mosh/issues/24#issuecomment-201893250 | |
| import sys | |
| import os | |
| import subprocess | |
| def main(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| '''parse /proc/{pid}/smaps and show how much RSS memory is used by each file/type''' | |
| import sys | |
| from collections import defaultdict | |
| def filesize(size: int) -> str: | |
| units = 'KMGTPEZY' | |
| left = abs(size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| import os | |
| import datetime | |
| import subprocess | |
| import logging | |
| import tempfile | |
| import contextlib | |
| from pathlib import Path |
NewerOlder