Skip to content

Instantly share code, notes, and snippets.

Omar A hagope

Block or report user

Report or block hagope

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hagope
hagope / stock.sh
Created Aug 6, 2014
Realtime Stock Quote from Google Finance using cURL
View stock.sh
#!/bin/bash
# Usage: stock.sh TWTR 30
# Say TWTR current price every 30 seconds
while true
do
curl -s https://www.google.com/finance?q=$1 | grep ref_ -m 1 | sed 's|<[^>]*>||g' | say
sleep $2
done
View rpi-input.py
# http://makezine.com/projects/tutorial-raspberry-pi-gpio-pins-and-python/
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
def printFunction(channel):
print(“Button 1 pressed!”)
print(“Note how the bouncetime affects the button press”)
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

@hagope
hagope / isbns.py
Created Feb 25, 2014
convert isbn10 to isbn13 and accounts for 8,9 digit isbn without leading zeroes
View isbns.py
def check_digit_10(isbn):
assert len(isbn) == 9
sum = 0
for i in range(len(isbn)):
c = int(isbn[i])
w = i + 1
sum += w * c
r = sum % 11
if r == 10: return 'X'
else: return str(r)
@hagope
hagope / pt_stalk replication delay
Last active Dec 27, 2015 — forked from silviabotros/pt_stalk replication delay
Getting the Seconds_Behind_Master status from MySQL
View pt_stalk replication delay
mysql -h localhost -u root -e "show slave status\G" | grep "Seconds_Behind_Master" | awk '{print $2}'
View gist:4596406
iPad
1024 × 690 In landscape on iOS 4.3
1024 × 672 In landscape on iOS 5
768 × 946 In portrait on iOS 4.3
768 × 928 In portrait on iOS 5
1024 × 660 Always showing bookmarks bar in landscape on iOS 4.3
1024 × 644 Always showing bookmarks bar in landscape on iOS 5
768 × 916 Always showing bookmarks bar in portrait on iOS 4.3
@hagope
hagope / rename.sh
Created Jul 9, 2012
bash script to deleting leading chars of file names in directory
View rename.sh
#!/bin/bash
a=1
for i in *.jpg; do
new=${i:9}
mv "${i}" "${new}"
let a=a+1
done
@hagope
hagope / dirTree.js
Created Jun 26, 2012
Output the file system as a JSON using node.js
View dirTree.js
var fs = require('fs'),
path = require('path')
function dirTree(filename) {
var stats = fs.lstatSync(filename),
info = {
path: filename,
name: path.basename(filename)
};
@hagope
hagope / monitor-mysql.sh
Created Jun 6, 2012
Shell command to monitor a MySQL process
View monitor-mysql.sh
while true; do mysql -uroot -e "show processlist" | grep 29357; sleep 10; done
You can’t perform that action at this time.