Skip to content

Instantly share code, notes, and snippets.

View SidharthArya's full-sized avatar
❤️

Sidharth Arya SidharthArya

❤️
View GitHub Profile
@SidharthArya
SidharthArya / alttab
Last active October 25, 2024 18:11
Sway Windows Manager Alt Tab behavior
#!/usr/bin/env python3
import sys
import json
import subprocess
direction=bool(sys.argv[1] == 't' or sys.argv[1] == 'T')
swaymsg = subprocess.run(['swaymsg', '-t', 'get_tree'], stdout=subprocess.PIPE)
data = json.loads(swaymsg.stdout)
current = data["nodes"][1]["current_workspace"]
#CODE
#Generate root password
import random, string
password = ''.join(random.choice(string.ascii_letters + string.digits) for i in range(20))
#Download ngrok
! wget -q -c -nc https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
! unzip -qq -n ngrok-stable-linux-amd64.zip
#Setup sshd
@SidharthArya
SidharthArya / Scratchpad.sh
Last active July 5, 2022 01:07
A simple script for bspwm to creating scratchpads
#!/usr/bin/env bash
all_args=("$@")
arg1=$1
arg2=$2
arg3="${all_args[@]:2}"
case $arg1 in
"title")
id=$(xdo id -n $arg2)
;;
"class")
@SidharthArya
SidharthArya / Steam
Last active April 10, 2020 17:29
Steam on gentoo
#!/bin/bash
docker run \
-ti \
--privileged \
--name steam \
-e DISPLAY=$DISPLAY \
-m 2G \
--cpus=3 \
-e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
-e STEAM_UID=$UID \
@SidharthArya
SidharthArya / desktop.sh
Last active June 18, 2020 04:42
Xmonad like Monitor for Bspwm
#!/bin/sh
MONITORS="$(bspc query -M --names)"
ARG1="$1"
FOCUSED_MONITOR="$(bspc query --names -M -m focused)"
for monitr in $MONITORS
do
FOCUSED="$(bspc query --names -D -d $monitr:focused)"
if [[ "$FOCUSED" == "$ARG1" ]];
@SidharthArya
SidharthArya / create-hotspot.md
Created April 13, 2022 19:12 — forked from narate/create-hotspot.md
Create Wi-Fi Hotspot on Linux using nmcli

Create a Wi-Fi hotspot on Linux using nmcli

Original post : https://unix.stackexchange.com/a/310699

nmcli con add type wifi ifname wlan0 con-name Hostspot autoconnect yes ssid Hostspot
nmcli con modify Hostspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
nmcli con modify Hostspot wifi-sec.key-mgmt wpa-psk
nmcli con modify Hostspot wifi-sec.psk "veryveryhardpassword1234"
@SidharthArya
SidharthArya / parse_yaml.bash
Created May 30, 2022 14:05
Parse Yaml with bash
function parse_yaml {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\):|\1|" \
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}
@SidharthArya
SidharthArya / tmux.conf
Created August 26, 2022 01:30
Simple tmux fzf for pane window and sessions
bind-key s display-popup -E "bash tmux_fzf.sh"
@SidharthArya
SidharthArya / autohotkey.ahk
Created February 7, 2023 19:53
Autohotkey Command+` for windows
#`:: ; Next Window
WinGetClass, CurrentActive, A
WinGet, ActiveProcess, ProcessName, A
WinGet, Instances, Count, ahk_exe %ActiveProcess%
; MsgBox, %ActiveProcess% %Instances%
If Instances > 1
WinSet, Bottom,, A
WinActivate, ahk_exe %ActiveProcess%
return