This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pdb | |
""" | |
The Bellman-Ford algorithm | |
Graph API: | |
iter(graph) gives all nodes | |
iter(graph[u]) gives neighbours of u | |
graph[u][v] gives weight of edge (u, v) | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xuartctl -p 0 -o 8o1 -s 9600 -d | |
# Client: | |
nc -v -w 30 -p 5600 -l > uart_gps_test | |
# Server: | |
nc -v -w 2 192.168.2.43 5600 < uart_gps_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Making eth0 work in asus u36s debian | |
modprobe atl1c | |
echo "1969 1083" > /sys/bus/pci/drivers/atl1c/new_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Force cientific notation in pyplot | |
formatter = ScalarFormatter() | |
formatter.set_scientific(True) | |
formatter.set_powerlimits((-3,3)) | |
plt.axes().yaxis.set_major_formatter(formatter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
# hexadec.pl | |
$foo = <STDIN>; | |
$hexval = sprintf("%x", $foo); | |
$decval = hex($hexval); | |
print "$decval\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Kill all sessions in tmux except the attached one: | |
tmux ls | grep -v attached | cut -d : -f 1 | xargs -I {} tmux kill-session -t {} | |
# Create a shared (group cnm_dev) git repo with acl | |
mkdir project | |
cd project | |
git init --bare --shared | |
setfacl -R -m g:cnm_dev:rwX $PWD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
main_tex = "report.tex" | |
current_level = 0 | |
def extract(line): | |
found = re.search('{.+}', line) | |
if found: | |
return found.group(0)[1:-1] | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file describes the network interfaces available on your system | |
# and how to activate them. For more information, see interfaces(5). | |
# The loopback network interface | |
auto lo | |
iface lo inet loopback | |
# The primary network interface | |
allow-hotplug eth0 | |
iface eth0 inet dhcp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write on | |
mount -o remount,rw -t ext4 /dev/block/platform/msm_sdcc.1/by-name/system /system | |
# Take a screenshot | |
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png | |
# verbose logging in sqlite | |
adb shell setprop log.tag.SQLiteLog V | |
adb shell setprop log.tag.SQLiteStatements V | |
adb shell stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To easilly transfer the generated data between the ARM and the PC do the following: | |
# | |
# In your pc: | |
# nc -l -p 2999 > received.json | |
# | |
# In the arm | |
# tail -f /tmp/data/miavita.json | nc 192.168.0.1 2999 | |
import numpy as np | |
import matplotlib.pyplot as plt |
OlderNewer