Skip to content

Instantly share code, notes, and snippets.

View gyaresu's full-sized avatar

Gareth gyaresu

View GitHub Profile
@gyaresu
gyaresu / HowToOTG.md
Created November 25, 2016 19:49 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int

#!/bin/bash
cat $1 | grep IRA >> $1_positions.csv
sed -i -e 's/^.\+sat:/sat:/' -e 's/\( RAI\:.\+\)\|\(sat:\)\|\(beam:\)\|\(pos=(\)\|\()\)\|\(alt=\)\|\(+\)//g' -e 's%/%;%' -e 's/ /;/g' -e '/^00;00/d' -e '1 i\satellite;beam;latitude;longitude;altitude' $1_positions.csv
awk -F ';' '($5<=100){print}' $1_positions.csv >> $1_positions_spotbeams.csv
awk -F ';' '($5>100){print}' $1_positions.csv >> $1_positions_satellites.csv
@gyaresu
gyaresu / find_system_python_dylibs.sh
Last active January 28, 2018 19:37 — forked from lokkju/find_system_python_dylibs.sh
This script prints the filenames of any libs in your /usr/local/lib that depend on the System Python. It is especially useful if you use a non-system Python, but have previously compiled extensions against the System Python - it will tell you which need to be recompiled.
#!/bin/bash
echo "This script prints the filenames of any dylibs in your /usr/local/ that depend on the System Python"
for f in `find /usr/local/lib`; do
otool -L "$f" 2> /dev/null| grep Python | grep System &> /dev/null
status=$?
if [ $status -eq 0 ]; then
echo "$status: $f"
fi
done
@gyaresu
gyaresu / gist:3233706
Created August 2, 2012 04:51 — forked from timf/gist:979708
diskspace alias
alias duf='du -sk * | sort -nr | perl -ne '\''($s,$f)=split(m{\t});for (qw(K M G)) {if($s<1024) {printf("%.1f",$s);print "$_\t$f"; last};$s=$s/1024}'\'''
@gyaresu
gyaresu / hackerchallenge2-spacex.js
Created July 28, 2012 22:46 — forked from mediaupstream/hackerchallenge2-spacex.js
HackerRank.com Challenge #2 (SpaceX) Solution in NodeJS
//
// HackerRank.com Challenge #2 (SpaceX Challenge)
// @hacker mediaupstream, aka Derek Anderson
//
// How to Win:
// 1. Install required npm packages: `npm install request sugar`
// 2. Modify the `username` and `password` variables below to match what you used to signup on
// hackerrank.com with
// 3. Run the script: `$ node hackerchallenge2-spacex.js`
// 4. Wait for about 40 minutes...
@gyaresu
gyaresu / hack.sh
Created March 31, 2012 17:01 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#