Skip to content

Instantly share code, notes, and snippets.

@dynax60
dynax60 / gist:80db096112857f36ae96087511078f5b
Created January 21, 2021 11:35
To get a tags from the remote docker repository
wget -q https://registry.hub.docker.com/v1/repositories/gitlab/gitlab-ce/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}' | egrep '^12.'
@dynax60
dynax60 / kafka-cheat-sheet.md
Created December 2, 2020 07:08 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@dynax60
dynax60 / main.py
Created November 21, 2020 19:10
lg-android-shortcuts
#!/usr/bin/env python
import os
import re
import sqlite3
from urllib.parse import unquote
def process(filename):
connection = sqlite3.connect(f'{filename}')
@dynax60
dynax60 / promo.py
Created September 15, 2020 18:25
Papa Johns promo code
bits='000011100010110100011011000011100010111100101011000011100010111000011111000011100010111000101111000011100010111100011001000011100010111000101110000011100010111000011100000011100010111100011001000011100010111000011001000011100010111000101100000011100010111000101100000011100010111000100001000011100010111100011010000011100010111100011011'
_bytes = [ int(bits[k:k+8],2) for k in range(0, len(bits), 8)]
for i in range(0, len(_bytes), 3):
byte1, byte2 = _bytes[i+1:i+3]
c = ((byte1 & 0x0f) << 4) | (byte2-0x20 if byte2 > 0x22 else byte2-0x19)
print(c.to_bytes(1, byteorder='little').decode('cp1251'), end="")
@dynax60
dynax60 / docker-removal.ps1
Created June 26, 2020 05:38
Power shell script for removing the Docker Desktop for Windows 10
# Original was taken from https://web.archive.org/web/20200611074334/https://success.docker.com/article/how-to-completely-remove-docker-in-windows-10
$ErrorActionPreference = "SilentlyContinue"
kill -force -processname 'Docker for Windows', com.docker.db, vpnkit, com.docker.proxy, com.docker.9pdb, moby-diag-dl, dockerd
try {
./MobyLinux.ps1 -Destroy
} Catch {}
@dynax60
dynax60 / cleaning.md
Last active October 25, 2021 13:11
Ansible playbook for installing Gitlab

Remove exited containers

docker ps -a -q -f status=exited | xargs --no-run-if-empty docker rm -v

Remove dangling images

docker images -f "dangling=true" -q | xargs --no-run-if-empty docker rmi

Remove unused images (warning!)

docker images | awk '/ago/ { print $3}' | xargs --no-run-if-empty docker rmi

Remove dangling volumes

@dynax60
dynax60 / gist:27689996e60106a3f3aaf90b09262fc6
Last active February 22, 2020 15:10
D-Link: show ports will ignore disabel clipaging
DGS-3120-24TC:admin#disable clipaging
Command: disable clipaging
Success.
DGS-3120-24TC:admin#show ports
Command: show ports
Port State/ Settings Connection Address
MDIX Speed/Duplex/FlowCtrl Speed/Duplex/FlowCtrl Learning
null@MacBook-Air-Denis [23:33:10] [~/netmiko/tests] [dlink *]
-> % py.test -v test_netmiko_config.py --test_device dlink_ds
============================================================= test session starts =============================================================
platform darwin -- Python 3.8.0, pytest-5.3.4, py-1.8.1, pluggy-0.13.1 -- /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
cachedir: .pytest_cache
rootdir: /Users/null/netmiko, inifile: setup.cfg
collected 7 items
test_netmiko_config.py::test_ssh_connect PASSED [ 14%]
test_netmiko_config.py::test_enable_mode PASSED [ 28%]
null@MacBook-Air-Denis [23:36:54] [~/netmiko/tests] [dlink *]
-> % py.test -v test_netmiko_show.py --test_device dlink_ds
============================================================= test session starts =============================================================
platform darwin -- Python 3.8.0, pytest-5.3.4, py-1.8.1, pluggy-0.13.1 -- /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
cachedir: .pytest_cache
rootdir: /Users/null/netmiko, inifile: setup.cfg
collected 14 items
test_netmiko_show.py::test_disable_paging PASSED [ 7%]
test_netmiko_show.py::test_ssh_connect PASSED [ 14%]
@dynax60
dynax60 / gist:44316bd60aba0acc0ff4c7188ce6ce91
Last active August 23, 2019 04:43
Get colored pagination with jq
curl -s "localhost:9200/_stats?level=shards" | jq -C | less -R