Skip to content

Instantly share code, notes, and snippets.

View kxalex's full-sized avatar
🏠
Working from home

Oleksii Shurubura kxalex

🏠
Working from home
View GitHub Profile
@kxalex
kxalex / dns-allowlist
Last active December 10, 2023 07:06
AdGuard DNS Allowlist
www.googleadservices.com
rottentomatoes.com
analytics.twitter.com
melia.com
trk.klclick.com
wl.spotify.com
clickserve.dartsearch.net
klclick1.com
e.customeriomail.com
@kxalex
kxalex / iphone-checker.py
Created September 20, 2022 09:59
iPhone checkers checks for iPhone 14 Pro available stocks
import requests
import time
import os
import subprocess
# MQ103ZP/A - S 256GB
# MQ0T3ZP/A - SB 256GB
#
# MQ1W3ZP/A - S 512GB
# MQ1M3ZP/A - SG 512GB
@kxalex
kxalex / ssh-hole.sh
Last active October 29, 2021 06:41
Replace default ssh with holepunch for Secure Pipes.app
#!/usr/bin/env bash
#
# INSTALLATION
#
# Copy me to /usr/local/bin/ssh-hole and make executable 'chmod +x /usr/local/bin/ssh-hole'
#
#set -x
@kxalex
kxalex / aws-login.sh
Created March 18, 2021 06:05
AWS create session token and save it to MFA profile
function aws-login() {
# set -x
# usage: aws-login token-code [aws-profile]
# token-code - a code from Authenticator
# aws-profile - session token will be created for this profile, if none supplied default or AWS_PROFILE will be used
local pkg=aws-login
local token_code=$1
if [[ ! $token_code ]]; then
@kxalex
kxalex / crontab
Last active March 6, 2021 06:42
Run cron job at random time
# Run /your/script.sh at random time
04 */3 * * * sleep $((RANDOM\%90))m; /your/script.sh
# RANDOM versions:
# ${RANDOM:0:2}m
# $[RANDOM\%90]m
#
# No bash version:
# $(( $(od -N1 -tuC -An /dev/urandom) \% 90 ))m
#
@kxalex
kxalex / ChooseLocation.scpt
Created February 16, 2021 08:06
AppleScript to choose network locations
# Quick access through fn^⌥⌘N hotkey (BetterTouchTool❤️)
set the_location to (choose from list (my switch_location("", true)) with prompt "Choose a Location to Activate:" OK button name "Activate")
if the_location = false then return
my switch_location(the_location as string, false) --of course you could hard code it: my switch_location("home", false)
on switch_location(the_location, return_locations)
tell application "System Events"
tell (item 1 of (processes whose frontmost = true))
tell menu bar 1
@kxalex
kxalex / ChooseInputDevice.scpt
Last active February 16, 2021 08:06
AppleScript to choose input device (i.e. microphone)
# Install SwitchAudioSource tool to make this script work
# brew install switchaudio-osx
# I assigned fn^⌥⌘M hotkey (using BetterTouchTool) to have quick access to input devices
set theInputDevices to paragraphs of (do shell script "/usr/local/bin/switchaudiosource -t input -a | sed -E 's/(.*)\\ \\(input\\)/\\1/'")
set theCurrentDevice to do shell script "/usr/local/bin/switchaudiosource -t input -c"
set theInput to choose from list theInputDevices with prompt "Select Input Device:" default items {theCurrentDevice}