Skip to content

Instantly share code, notes, and snippets.

View nikhilw's full-sized avatar

Nikhil Wanpal nikhilw

View GitHub Profile
@nikhilw
nikhilw / toggleMicOneLiner.sh
Last active August 10, 2022 08:08
Toggle mic on-off on a Ubuntu / Linux Mint machine with a keyboard shortcut
#! /bin/sh
# static icon, easier to set as a bash alias or directly use as a single command instead of creating a script file.
amixer set Capture toggle | gawk 'match($0, /Front Left.*\[(.*)\]/, a) {print a[1]}' | xargs notify-send --hint=int:transient:1 -i "audio-input-microphone" "Mic switched: $1"
@nikhilw
nikhilw / package-amazon-music.sh
Last active March 9, 2018 13:20
Create amazon prime music desktop player for Linux
# You need
# 1. nativefier installed, install it as: npm install -g nativefier
# 2. a logo for your app, download and place locally as logo.png
#! /bin/sh
nativefier --name "Amazon music" --inject ./user-agent-switch.js --icon ./logo.png https://music.amazon.in/
@nikhilw
nikhilw / commit-msg
Last active April 17, 2023 11:36
git commit hook using node to ensure commit message follows a convention
#!/usr/bin/env python3
# NOTES:
# 1. This is one of the three implementation, this one is in Python. if you do not have python installed, there are 'node' and 'scala' counterparts.
# 2. To use this file, place it in .git/hooks/ in your repository.
# 3. You can also use this script with the 'husky' npm module.
import sys
import os
import re