Skip to content

Instantly share code, notes, and snippets.

Avatar

Chinmay Pendharkar notthetup

View GitHub Profile
View wifi-card.sh
#!/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 Dec 29, 2020 — 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/
View script-template.sh
#!/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 Mar 12, 2020
Javascript to find modems.
View findmodem.js
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);
View alsa-error
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 Dec 8, 2019
Get URLs from list of google search terms
View geturls.sh
while IFS= read -r line; do googler -n1 --json "$line" 2>/dev/null | jq -r '.[].url'; done < terms.txt
View phyclk.py
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)
View prose.zsh-theme
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%})"
View iperf3.service
[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 Nov 23, 2018
World's dumbest HTTP client
View http.sh
echo "GET / HTTP/1.1\r\n\r\n" | nc 192.168.0.62 80
View keybase.md

Keybase proof

I hereby claim:

  • I am notthetup on github.
  • I am notthetup (https://keybase.io/notthetup) on keybase.
  • I have a public key whose fingerprint is C0EF A65E 48CF A414 58F5 548C 11C1 79B9 1E30 2E6A

To claim this, I am signing this object: