Skip to content

Instantly share code, notes, and snippets.

View artizirk's full-sized avatar

Arti Zirk artizirk

View GitHub Profile
@artizirk
artizirk / how-to-restore.md
Last active November 27, 2023 09:29 — forked from AmazingTurtle/how-to-restore.md
restore access to unifi controller

Restore access to a unifi controller

When you are unable to login to the unifi controller or forgot admin password, you can restore access using SSH and manipulating mongodb directly.

Warning

Do not uninstall unifi controller - most of the data is not stored in mongodb. In case you thought a mongodb backup would be sufficient, you may have fucked up already, just like me. However I managed to write this "tutorial" for anyone to not run into the same trap.

Apparently this guide no longer works with recent unifi controller versions (starting nov/dec 2022). Since I no longer use unifi hardware in my home system, I can not update the guide myself. In case you've gotten here to recover your data, you're likely doomed. But giving it a try won't hurt anyway, therefore: good luck.

@artizirk
artizirk / clickup_api.service.ts
Created July 26, 2023 08:34
Clickup ApiService from chrome extention, includes some nondocumented API's
let ApiService = class ApiService extends ngx_oauth_client__WEBPACK_IMPORTED_MODULE_2__["NgxOAuthClient"] {
constructor(http, data, router, slimLoadingBarService) {
super(http);
this.http = http;
this.data = data;
this.router = router;
this.slimLoadingBarService = slimLoadingBarService;
this.isLoading = false;
this.showStorageErrorMsg = false;
}
@artizirk
artizirk / parse_pyvenv.zsh
Last active July 12, 2023 15:53
Parse python venv and virtualenv pyvenv.cfg with pure ZSH
#!/usr/bin/env zsh
# Parse python venv and virtualenv pyvenv.cfg with pure ZSH
#
# My usecase was to get the custom virtualenv prompt name from
# python virtualenvs created by poetry and virtualenv package.
# Builtin venv puts the prompt value also into environment variable
# called VIRTUAL_ENV_PROMPT that makes my life much easier.
# Virtualenv guys recommend to use pyvenv.cfg
# https://github.com/pypa/virtualenv/issues/2194
# https://github.com/pypa/virtualenv/issues/1968
@artizirk
artizirk / imx8mn.md
Created June 3, 2022 09:28
imx8mn boot cortex-m7 core without bootaux

imx8mn has an extra cortex-m7 core. you have few options for starting it

  1. use downstream imx-atf and mainline u-boot bootaux command
  2. use upstream atf and poke at the registers manually

For option 1 you can follow the AN5317 app note and things should work out fine

fatload mmc 1:1 0x48000000 hello.bin
cp.b 0x48000000 0x7e0000 $filesize
bootaux 0x7e0000
@artizirk
artizirk / dash_to_bash.sh
Last active October 30, 2021 20:49
Make /bin/sh point to bash under Debian/Ubuntu
#!/bin/sh
# Make /bin/sh point to bash
echo dash dash/sh boolean false | debconf-set-selections -v
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
@artizirk
artizirk / standalone_canopen.py
Created August 2, 2021 15:49
Minimal CANOpen in plain standalone Python3 using only standard lib
#!/usr/bin/python3
"""Minimal CANOpen in plain standalone Python3 using only standard lib
This is incomplete but works well enough to read and write small Objects using SDO protocol
"""
import ctypes
import enum
import socket
import struct
import time
@artizirk
artizirk / nginx.conf
Last active November 13, 2024 01:46
Nginx config for scaling matrix synapse server via workers
# Matrix Synapse workers example config
# backends
upstream synapse_master {
server 192.19.18.12:38008;
}
upstream synapse_federation {
server 192.19.18.12:8083;
}
@artizirk
artizirk / 0README.md
Last active December 5, 2023 09:02
List SerialPort names in Windows

List COM ports in windows with names

HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM
    \Device\Serial0    REG_SZ    COM1
    \Device\Silabser0    REG_SZ    COM6
    \Device\VCP0    REG_SZ    COM3

Press any key to continue . . .
@artizirk
artizirk / annnotate.sh
Created March 18, 2021 15:05
Annotate WireGuard wg command output with comments from the config file
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
function annotate {
declare -A PEER_COMMENTS