Skip to content

Instantly share code, notes, and snippets.

@dbalan
dbalan / test_ping.sh
Last active December 12, 2015 08:28
Tests pings.
#!/bin/bash
if [ $# != 2 ]; then
echo "USAGE: " ${0}" ip-addr warning-level" ;
exit;
fi
timeout 3 ping -c 1 $1 > /tmp/out
if [ $? -ne 0 ]; then
@dbalan
dbalan / find_largest_contour.py
Last active December 14, 2015 18:09
To find the largest blob.
from cv2 import *
import numpy as np
import serial
# Use camera
camera = cv.CaptureFromCAM(1)
photo = cv.QueryFrame(camera)
matrix = cv.GetMat(photo)
#convert image
wget google.com
--2013-03-20 11:32:15-- http://google.com/
Connecting to 192.168.200.203:3128... connected.
Proxy request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2013-03-20 11:32:41-- http://www.google.com/
Connecting to 192.168.200.203:3128... connected.
Proxy request sent, awaiting response... 302 Moved Temporarily
Location: http://www.google.co.in/ [following]
--2013-03-20 11:33:03-- http://www.google.co.in/
@dbalan
dbalan / rtems_semaphore_patch.diff
Created April 16, 2013 18:08
RTEMS GDB Python
diff rtems-20100326/objects.py /home/dhananjay/Downloads/rtems-20100326/objects.py
64a65,67
> return self.object_return(api, _class, index)
>
> def object_return(self, api, _class, index):
99c102
< 'class': (27, 31) }
---
> 'class': (27, 31) }
150c153
@dbalan
dbalan / python_gdb_rtems
Created April 16, 2013 18:17
Debug info
Name: LBIO
Attr: 0x00000054,local,pri,bin-sema,inherit-pri,no-pri-ceiling
Lock: unlocked
Nesting: 0
Blocked: 0
Holder: unlocked
---------------------------------------------------------------------------
error Traceback (most recent call last)
<ipython-input-16-e625cbe47821> in <module>()
----> 1 sem.show(id)
#
# RTEMS Threads Support
# Copyright 2010 Chris Johns (chrisj@rtems.org)
#
# $Id$
#
import gdb
import chains
(gdb) rtems object 436273153
436273153
API:classic Class:semaphores Node:1 Index:1 Id:1A010001
Name: LBIO
Attr: 0x00000054,local,pri,bin-sema,inherit-pri,no-pri-ceiling
Lock: unlocked
Nesting: 0
Blocked: 0
Holder: unlocked
Queue: len = 8, state = waiting-for-mutex
(gdb) source __init__.py
RTEMS GDB Support loaded
(gdb) rtems semaphores
Name: LBIO
Attr: 0x00000054,local,pri,bin-sema,inherit-pri,no-pri-ceiling
Lock: unlocked
Nesting: 0
Blocked: 0
Holder: unlocked
Queue: len = 8, state = waiting-for-mutex
+-------------+
| gdb.Command |
+-------------+
.
/_\
| [ gdb.Command ] [ gdb.Command ]
| . .
| /_\ /_\
| | |
| | |
diff rtems-20100326/chains.py /tmp/rtems-20100326/chains.py
17,19c17
< if not self.node_val:
< return True
< return False
---
> return self.node_val['next'] == 0
23c21
< self.node_val = self.node_val['next']
---