Skip to content

Instantly share code, notes, and snippets.

View warvariuc's full-sized avatar

Victor Varvaryuk warvariuc

  • Moldova, Chisinau
View GitHub Profile
@warvariuc
warvariuc / stale_remote_branches.sh
Last active June 10, 2023 18:23
List remote branches with latest commit date, author and description. The is used to review stale remote branches.
git for-each-ref --sort=committerdate refs/remotes/origin/ --format='%(committerdate:short) %(authorname) %(refname:lstrip=3)'
def flatten_dict(data: dict):
"""Transform a dict with nested dicts/list to a one level dict with keys containing paths to
the original values encoded as `top_level_key.nested_key[list_item_index]`
"""
def iterate(_data, _path=""):
if isinstance(_data, dict):
for _key, _value in _data.items():
yield from iterate(_value, f"{_path}.{_key}".lstrip("."))
elif isinstance(_data, tuple | list):
@warvariuc
warvariuc / 1.py
Created November 23, 2023 19:23
Filter a MAC addr via API on an OpenWRT router
"""
https://github.com/openwrt/luci/blob/master/docs/JsonRpcHowTo.md
opkg update
opkg install luci-mod-rpc luci-lib-ipkg luci-compat
/etc/init.d/uhttpd restart
"""
import httpx
class Router:
@warvariuc
warvariuc / copy_header_with_each_row.vba
Last active March 13, 2024 10:37
Take current sheet, copy it as a new one, remove formulas leaving only values, insert first row (header) before each other. Useful for printing the table to able to cut with scissors each row with its own header.
Sub CopyHeaderWithEachRow()
Doc = ThisComponent
Sheets = Doc.Sheets
Controller = Doc.CurrentController
ActiveSheet = Controller.getActiveSheet()
Selection =Controller.getSelection()
SelAddress = selection.RangeAddress