Skip to content

Instantly share code, notes, and snippets.

View notthetup's full-sized avatar
🔊

Chinmay Pendharkar notthetup

🔊
View GitHub Profile
@notthetup
notthetup / gist:4213687
Created December 5, 2012 08:09 — forked from aehlke/gist:992798
zsh hooks to growl completion of long-running commands
# long-running command growler
# hooks for zsh, built on bash version at http://hints.macworld.com/article.php?story=20071009124425468
preexec_functions+='save_preexec_time'
save_preexec_time() {
export PREEXEC_CMD="$(history $HISTCMD | tail -n 1| sed 's/ *[0-9]* *//')"
export PREEXEC_TIME=$(date +'%s')
}
precmd_functions+='growl_about_long_running_commands'
@notthetup
notthetup / whatsapp.md
Last active November 29, 2023 09:46
WhatsApp Usage Tips by @ngkabra

WhatsApp (if used well) is one the best things that has happened in communications in recent times.

It is excellent for deepening bonds with friends, relatives, and professional contacts.

But you have to work to ensure that WhatsApp doesn't degenerate into uselessness/toxicity 

By default WhatsApp can be too noisy and a distraction. Here's 4 things I have done to improve the situation significantly:

1. Surgical notifications
2. Ruthless exits from noisy large groups

@notthetup
notthetup / wavepotscripts.md
Last active August 27, 2023 20:48
A list of interesting wavepot scripts.
@notthetup
notthetup / soxleveller.sh
Last active February 16, 2023 18:43
SoX Normalize (Leveller) for speech.
#!/bin/bash
filename=${1%%.*}
extension=${1##*.}
outputname="$filename"_levelled.$extension
sox $1 $outputname highpass 80 lowpass 8000 compand 0.01,1 -80,-80,-55,-20,-20,-15,0,0 0 -40 0.1 norm -0.5
#!/usr/bin/env bash
out="${1:-wifi-card.pdf}"
read -rp "SSID: " ssid
read -rsp "Password: " pass
echo -e "\nGenerating PDF..."
{
cat << EOF
<table>
<tr>
<td><img src="data:image/png;base64,$(qrencode -o - -t png "WIFI:T:WPA;S:$ssid;P:$pass;;" | base64)"></td>
@notthetup
notthetup / script-template.sh
Created December 29, 2020 07:52 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@notthetup
notthetup / findmodem.js
Created March 12, 2020 09:06
Javascript to find modems.
function findModems(baseIP='192.168.0', lowIP=0, highIP=255, maxInFlight=20, timeout=4000) {
var currIP = lowIP;
var inFlight = 0;
var modems = [];
var path = '/ws/';
return new Promise( resolve => {
function tryOne(ip) {
++inFlight;
var socket = new WebSocket('ws://' + baseIP + ip + path);
1583883726606|INFO|physical.c:102|Serial: unetaudio
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
@notthetup
notthetup / geturls.sh
Created December 8, 2019 05:30
Get URLs from list of google search terms
while IFS= read -r line; do googler -n1 --json "$line" 2>/dev/null | jq -r '.[].url'; done < terms.txt
@notthetup
notthetup / soxplot.sh
Created April 5, 2014 14:13
Whole file spectrum using SOX and gnuplot.
sox $1 -n stat -freq 2>&1 | sed -n -e :a -e '1,15!{P;N;D;};N;ba' | gnuplot -p -e 'set logscale x; plot "-" with linesp'