Skip to content

Instantly share code, notes, and snippets.

View zlocate's full-sized avatar

Denis zlocate

  • Yandex.Practicum
View GitHub Profile
@zlocate
zlocate / gist:8ea109508d3b16010a8620ecec90bb85
Created January 3, 2025 00:49 — forked from tsjnachos117/gist:8231f9f8ed08968cc5f1a7f4d3e06b0e
Get KDE Connect battery info (from desktop/laptop)

I find the ability to get my android devices' battery info on my desktops via cli to be extremely convenient. I used to be able to this with KDE Connect easily, but things have just changed. Since I can't find any documentation on how to do this, and since I just stumbled on the answer myself, I though I might share what I know here. Please note that in the examples below, I will be using {device-id} as a placeholder for the string that KDE Connect uses to identify to my devices.

That said, I used to be able to get my various devices' battery status through gdbus through the following:

    gdbus call --session --dest org.kde.kdeconnect --object-path /modules/kdeconnect/devices/{device-id} --method org.kde.kdeconnect.device.battery.charge

However on Arch, I now get the following error: Error: GDBus.Error:org.freedesktop.DBus.Error.UnknownInterface: No such interface 'org.kde.kdeconnect.device.battery' at object path '/modules/kdeconnect/devices/b04294f19e8767f5'. I don't get this message on Ubuntu 2

@zlocate
zlocate / README.md
Last active July 26, 2024 17:10
Get fastest npm cdn mirror

IP Address Latency Checker (for NPM registry)

This script reads a list of IP addresses from a file, performs multiple iterations of latency checks using curl, and outputs the top 3 IP addresses with the lowest latency. It also displays progress information for each iteration.

Usage

  1. Save the script to a file, e.g., check_ips.sh.
  2. Make the script executable:

chmod +x check_npm.sh

#!/usr/bin/env python3
import time
import requests
import sys
from datetime import datetime, timezone
from dateutil import parser
import re
if len(sys.argv) != 4:
@zlocate
zlocate / apt-fast-install.sh
Created May 13, 2024 15:47
apt-fast-install
#!/bin/bash
/bin/bash -c "$(curl -sL https://git.io/vokNn)"
@zlocate
zlocate / kaniko-build-docker-image.yml
Created March 7, 2024 18:51
CI pipeline for building Docker images at Kubenertes cluster with Kaniko (env flag customization also available)
stages:
- build
variables:
REGISTRY_IMAGE_PATH: "${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}:${CI_COMMIT_SHORT_SHA}"
PUSH_IMAGE: "true"
GIT_DEPTH: 1
DOCKER_FILE_NAME: "Dockerfile"
kaniko-build-docker-image:
@zlocate
zlocate / PKGBUILD
Created March 7, 2024 18:49
Rapid SSH Proxy (https://github.com/Snawoot/rsp) package build config (PKGBUILD) for Arch Linux/Manjaro
pkgbase='rsp'
pkgname=('rsp')
_module='rsp'
pkgver='1.0.1'
pkgrel=1
pkgdesc="Rapid SSH Proxy"
url="https://github.com/Snawoot/rsp"
depends=('python' 'python-asyncssh')
makedepends=('python-setuptools')
license=('MIT')
@zlocate
zlocate / README.md
Last active December 17, 2023 13:10
Создание загрузочной флешки под Linux из ISO образа при помощи dd

Скрипт cоздания загрузочной флешки из ISO-образа

Этот скрипт позволяет записывать ISO-образ на указанное устройство (например, usb-флешку) при помощи dd.

Использование

./write-iso-to-usb.sh /path/to/manjaro.iso /path/to/device
@zlocate
zlocate / README.md
Last active December 15, 2023 21:55
Script for getting list of installed packages

Manjaro Helpers (Installed Packages)

Скрипты для получения списка установленных пакетов / aur-зависимостей. Полезны при миграции с одной сборки на другую или при переустановке системы.

@zlocate
zlocate / git-config-user-for-remote.md
Created November 10, 2023 23:17 — forked from BadgerCode/git-config-user-for-remote.md
Use different emails for different git repositories

Edit ~/.gitconfig

[user]
        email = [email protected]
        name = Michael Hawkins
[includeIf "hasconfig:remote.*.url:[email protected]:YOUR_COMPANY_NAME/**"]
        path = ~/Documents/Projects/Work/.gitconfig
#!/bin/bash
# Get node_modules dirs total size
# find . -name "node_modules" -type d -prune -print | xargs du -chs /
# Remove all node_modules dirs
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;