Skip to content

Instantly share code, notes, and snippets.

@shvchk
shvchk / test-open-files-limit.sh
Last active August 29, 2023 21:22
Test max open files limit, `ulimit -n` | Source: https://stackoverflow.com/a/68895690
#!/usr/bin/env bash
case $BASH_VERSION in
''|[1-3].*|4.0.*) echo "ERROR: Bash 4.1 or newer required" >&2; exit 1;;
esac
[[ $1 ]] || { echo "Usage: $0 number-of-files" >&2; exit 1; }
echo "Running as process $$" >&2
for ((i=0; i<$1; i++)); do
exec {fd_num}>/dev/null || {
@shvchk
shvchk / xiaomi-bloatware.txt
Created July 25, 2023 05:45
Xiaomi MIUI debloat list. Initially made for Poco M5, but will probably work fine for any recent Xiaomi phone
com.android.bips
com.android.bookmarkprovider
com.android.printspooler
com.android.providers.partnerbookmarks
com.android.stk
com.android.traceur
com.bsp.catchlog
com.facebook.appmanager
com.facebook.services
com.facebook.system
@shvchk
shvchk / adb-uninstall.sh
Last active July 28, 2023 06:54
Uninstall list of apps with adb | Usage: ./adb-uninstall.sh <file with apps list> | Example: ./adb-uninstall.sh bloatware.txt or ./adb-uninstall.sh https://example.com/bloatware.txt | Video demo: https://youtu.be/knvvIPyttRs
#! /usr/bin/env bash
set -euo pipefail
[[ -v 1 ]] || { echo "Usage: $(basename -- "$0") <file/URL with apps list>"; exit 1; }
echo "Waiting for device"
adb wait-for-device
if [[ $1 == https://* ]]; then
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
rem 0 - Disable SmartScreen Filter in Microsoft Edge / 1 - Enable
reg add "HKCU\Software\Microsoft\Edge\SmartScreenEnabled" /ve /t REG_DWORD /d "0" /f
rem 0 - Disable SmartScreen PUA in Microsoft Edge / 1 - Enable
reg add "HKCU\Software\Microsoft\Edge\SmartScreenPuaEnabled" /ve /t REG_DWORD /d "0" /f
rem 1 - Enable Microsoft Defender SmartScreen DNS requests
reg add "HKLM\Software\Policies\Microsoft\Edge" /v "SmartScreenDnsRequestsEnabled" /t REG_DWORD /d "0" /f
@shvchk
shvchk / Start-WindowsCleanup.ps1
Created July 9, 2023 17:52 — forked from DrEmpiricism/Start-WindowsCleanup.ps1
Clean-up system clutter and reclaim disk space
Function Start-WindowsCleanup
{
<#
.SYNOPSIS
`Start-WindowsCleanup` cleans-up a system clutter and reclaims disk space.
.DESCRIPTION
The `Start-WindowsCleanup` cmdlet performs the following clean-up tasks to reclaim disk space:
Clears the contents of common directories of the Windows file system for both the current running user and the global system that are used to store temporary, logging, backup, cache and dump files.
@shvchk
shvchk / youtubedr-update
Last active June 27, 2023 15:45
youtubedr updater
#! /usr/bin/env bash
set -euo pipefail
executable="youtubedr"
executable_dir="$(dirname -- "$(which $executable)")"
repo="kkdai/youtube"
release_url="https://api.github.com/repos/$repo/releases/latest"
cur_version="$($executable version | grep '^Version:' | awk '{print $2}')"
new_version_raw="$(curl -sL "$release_url" | jq -r .tag_name)"
@shvchk
shvchk / mpv-ytdr
Last active June 27, 2023 15:42
Quickly open YouTube video with mpv and youtubedr
#! /usr/bin/env bash
DEPS=( "youtubedr" "mpv" )
for i in "${DEPS[@]}"; do
command -v "$i" >/dev/null 2>&1 || {
echo >&2 "$i required, but it's not installed. Aborting.";
exit 1
}
done
@shvchk
shvchk / install-chocolatey-gui.ps1
Last active June 22, 2023 02:54
Install Chocolatey + GUI and basic utilities
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install chocolateygui choco-cleaner choco-update-notifier -y
@shvchk
shvchk / install-chocolatey.ps1
Created March 16, 2023 23:01
Default Chocolatey install commands from https://chocolatey.org/install
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))