Skip to content

Instantly share code, notes, and snippets.

View notthetup's full-sized avatar
🔊

Chinmay Pendharkar notthetup

🔊
View GitHub Profile
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%})"
@notthetup
notthetup / ser2net.conf
Last active February 7, 2019 08:43
ser2net conf for pushing GPS NMEA strings over TCP
TRACEFILE:trace1:/var/log/ser2net.log
2947:raw:0:/dev/ttyACM0: 115200 8DATABITS NONE 1STOPBIT NOBREAK max-connections=5 tr=trace1
[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

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:

@notthetup
notthetup / 10-sysinfo
Created October 11, 2018 06:42
sysinfo motd for TX1
#!/bin/sh
#
# Copy this file to /etc/update-motd.d/
# Remove all other files from /etc/update-motd.d/
date=`date`
load=`cat /proc/loadavg | awk '{print $1}'`
root_usage=`df -h / | awk '/\// {print $(NF-1)}'`
memory_usage=`free -m | awk '/Mem/ { printf("%3.1f%%", $3/$2*100) }'`
users=`users | wc -w`
@notthetup
notthetup / dist.py
Created September 19, 2018 04:00
Calculate live distance between two GPS(NMEA) over TCP devices.
#!/usr/bin/env python3
# Calculates distance between two GPS (NMEA) devices sharing location over TCP.
#
# Dependencies : pynmea2, arlpy
#
# Usage dist.py <local-ip-address> <local-gps-port> <remote-ip-address> <remote-gps-port>
# Usage dist.py <local-ip-address> <remote-ip-address>
Peer Review Checklist: Embedded C Code
Before Review:
0 _____ Code compiles clean with extensive warning checks (e.g. MISRA C rules)
Reviewer #1:
1 _____ Commenting: top of file, start of function, code that needs an explanation
2 _____ Style is consistent and follows style guidelines
3 _____ Proper modularity, module size, use of .h files and #includes
4 _____ No orphans (redundant, dead, commented out, unused code & variables)
@notthetup
notthetup / howinternetwork.md
Created January 16, 2018 05:57
How Internet Work Series from Security Now