Skip to content

Instantly share code, notes, and snippets.

View sub314xxl's full-sized avatar

Konstantin Mokhnatkin sub314xxl

  • Moscow, Russian Federation
View GitHub Profile
@sub314xxl
sub314xxl / install.js
Created June 22, 2024 14:34 — forked from ArtemAvramenko/install.js
Fastest install script for npm 7.0+, speed up npm ci
// Fastest install script for npm 7.0+
// usage: node install
const fs = require('fs');
const readLockFile = path => {
if (fs.existsSync(path)) {
const text = fs.readFileSync(path, { encoding:'utf8', flag:'r' });
const lockFile = JSON.parse(text);
delete lockFile.dependencies;

Audio Mod Troubleshooting Guide

Search the XDA thread

This should always be your first step. More than likely, your question has already been answered...multiple times

Logs

If you make a post stating a problem without any logs, nobody can help you and will likely ignore it (at least I will)

  • Get a full logcat. If using adb, use adb logcat -d > log.txt
    • This should be taken after attempting to open the app
  • Get an audio dumpsys:
@sub314xxl
sub314xxl / mikrotik-wlan-auto-off.sh
Created April 10, 2024 04:41
mikrotik wifi tricks
# Script to ensure wireless lan radio is ON or OFF #
# between user selected times #
# The radio ON/OFF operation will not be performed if the system #
# clock is not in sync with local time, unless so required #
# Remember router is set back to default time after a reboot #
# Schedule this script at required intervals #
# Written by Peter James 2012-07-19 #
# Tested on RB751U and RouterOS v5.19 #
#####################################
@sub314xxl
sub314xxl / Get-LastBootDurations.ps1
Created April 7, 2024 12:25
PoSH: get boot process duration
Get-WinEvent -FilterHashtable @{LogName="Microsoft-Windows-Diagnostics-Performance/Operational"; Id=100} -MaxEvents 10 | ForEach-Object {
# convert the event to XML and grab the Event node
$eventXml = ([xml]$_.ToXml()).Event
# output
[PSCustomObject]@{
'Computer' = $eventXml.System.Computer
'BootTime' = [int64]($eventXml.EventData.Data | Where-Object {$_.Name -eq 'BootTime'}).InnerXml
'BootFinished' = [datetime]($eventXml.EventData.Data | Where-Object {$_.Name -eq 'BootEndTime'}).InnerXml
}
}
@sub314xxl
sub314xxl / clean-k8s.sh
Created March 27, 2024 20:35
clean up k8s cluster
for ns in $(kubectl get ns -o name | cut -d'/' -f2); do
for pod in $(kubectl get pods -n $ns --field-selector=status.phase!=Running -o name | cut -d'/' -f2); do
kubectl delete pod -n $ns $pod
done
for rs in $(kubectl get rs -n "$ns" -o name | cut -d'/' -f2); do
kubectl delete rs -n $ns $rs
done
done
kubectl get pods -A && kubectl top pods -A && kubectl top node
@sub314xxl
sub314xxl / kubectl.md
Created January 31, 2024 19:39 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@sub314xxl
sub314xxl / optimal_mtu.md
Created January 2, 2024 13:00 — forked from nitred/optimal_mtu.md
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@sub314xxl
sub314xxl / kubedf
Created December 26, 2023 08:10 — forked from redmcg/kubedf
Bash script to show k8s PVC usage
#!/usr/bin/env bash
NODESAPI=/api/v1/nodes
function getNodes() {
kubectl get --raw $NODESAPI | jq -r '.items[].metadata.name'
}
function getPVCs() {
jq -s '[flatten | .[].pods[].volume[]? | select(has("pvcRef")) | '\
@sub314xxl
sub314xxl / systemd_service_hardening.md
Created October 14, 2023 18:14 — forked from ageis/systemd_service_hardening.md
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@sub314xxl
sub314xxl / Win11TaskBarTweaks.cmd
Created September 5, 2023 15:45
Windows 11 enable text ttles for taskbar buttons
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /V TaskbarGlomLevel /T REG_DWORD /D 2 /F
taskkill /f /im explorer.exe
start explorer.exe