Skip to content

Instantly share code, notes, and snippets.

View notthetup's full-sized avatar
🔊

Chinmay Pendharkar notthetup

🔊
View GitHub Profile
@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

#!/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
import serial
import time
ser = serial.Serial('/dev/ttyTHS1', 460800)
ser.reset_input_buffer(); ser.write(b'0'); line = ser.readline(); time.sleep(0.1); ser.write(b'y'); line = ser.readline(); print int(line[4:],16)
if [ "x$OH_MY_ZSH_HG" = "x" ]; then
OH_MY_ZSH_HG="hg"
fi
function box_name {
[ -f ~/.box-name ] && cat ~/.box-name || hostname -s
}
local prompt_char="%(?,%{$fg[magenta]%}❯%{$reset_color%},%{$fg[red]%}❯%{$reset_color%})"
[Unit]
Description=iperf3 server
After=syslog.target network.target auditd.service
[Service]
User=root
ExecStart=/usr/local/bin/iperf3 -s --logfile /var/log/iperf.log
[Install]
WantedBy=multi-user.target
@notthetup
notthetup / http.sh
Last active November 23, 2018 07:04
World's dumbest HTTP client
echo "GET / HTTP/1.1\r\n\r\n" | nc 192.168.0.62 80