Skip to content

Instantly share code, notes, and snippets.

View Jamim's full-sized avatar

Aliaksei Urbanski Jamim

View GitHub Profile
@Jamim
Jamim / force-inet4-or-inet6.c
Created November 30, 2023 00:27 — forked from winny-/force-inet4-or-inet6.c
Force IPv4 or IPv6 in applications such as Lynx
/*
force-inet4-or-inet6.c - hack to force applications to use IPv4 or IPv6 exclusively
compilation: cc -fPIC -shared -DUSE_INET4 -o force-inet4.so force-inet4-or-inet6.c
cc -fPIC -shared -DUSE_INET6 -o force-inet6.so force-inet4-or-inet6.c
usage: LD_PRELOAD=/path/to/library.so program args ...
This file is in the public domain.
*/
@Jamim
Jamim / clean-up-twint-repo.sh
Created October 19, 2019 22:55
Clean up the twint repository
#!/bin/bash
# !!! WARNING !!!
# Before you execute this script you should backup your repository.
# https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_the_nuclear_option_filter_branch
git filter-branch --prune-empty --tree-filter 'rm -rf graph/node_modules' -- --all
# https://stackoverflow.com/questions/7654822/remove-refs-original-heads-master-from-git-repo-after-filter-branch-tree-filte
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
@Jamim
Jamim / test-dashboard.json
Created July 18, 2019 13:20
Grafana CSV exporting bug: test dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@Jamim
Jamim / docker_descendants.py
Created June 26, 2019 10:16 — forked from altaurog/docker_descendants.py
Python3 script to find descendants of one or more docker images
#!/usr/bin/python3
#
# usage: python3 docker_descendants.py <image_id> ...
import sys
from subprocess import check_output
def main(images):
image_ids = set(images)
@Jamim
Jamim / pipenv-docker-compose-7a696ceb-log.txt
Created October 4, 2018 22:31
pipenv-docker-compose-7a696ceb-log.txt
irma-sun /home/mim/projects/third-party/pipenv # git --no-pager log --oneline -1
7a696ceb (HEAD -> old-master) hope i don't regret this :)
irma-sun /home/mim/projects/third-party/pipenv # docker rm pipenv_pipenv-tests_1; docker-compose up
pipenv_pipenv-tests_1
Creating pipenv_pipenv-tests_1 ... done
Attaching to pipenv_pipenv-tests_1
pipenv-tests_1 | Collecting certifi
pipenv-tests_1 | Downloading https://files.pythonhosted.org/packages/df/f7/04fee6ac349e915b82171f8e23cee63644d83663b34c539f7a09aed18f9e/certifi-2018.8.24-py2.py3-none-any.whl (147kB)
pipenv-tests_1 | Installing collected packages: certifi
pipenv-tests_1 | Successfully installed certifi-2018.8.24
@Jamim
Jamim / detect-pipenv-lock-bug.sh
Last active July 27, 2018 13:48
detect-pipenv-lock-bug.sh
#!/bin/bash
ATTEMPTS=20
step () {
tput setaf 5; tput bold
echo
echo "$@"
tput sgr 0
@Jamim
Jamim / parser.py
Last active May 24, 2018 23:43
Simple helper for iservice.by
from csv import writer
from os import listdir
from os.path import isfile
from sys import argv
import logging
import re
logger = logging.getLogger('iservice')
@Jamim
Jamim / labeled_enum.py
Last active April 6, 2018 14:54
Labeled enum for Python 3.4+ (tested with Python 3.6)
from enum import Enum
class LabeledEnum(Enum):
@staticmethod
def __new_member__(cls, value, label):
enum_member = object.__new__(cls)
enum_member._value_ = value
enum_member.label = label
return enum_member
@Jamim
Jamim / unet_2018.03.04.txt
Last active March 4, 2018 01:06
UNET s95-150 1000baseT/100baseT
# ethtool -s enp7s0 speed 100 duplex full
# ethtool enp7s0
Settings for enp7s0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Half 1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Supported FEC modes: Not reported