Skip to content

Instantly share code, notes, and snippets.

@sucotronic
sucotronic / gist:5832018
Created June 21, 2013 15:30
know how much memory is eating google chrome
ps aux | grep chrome | grep -v grep | awk '{sum+=$6} END {print "chrome total: " sum/(1024*1024) " GB"}'
@sucotronic
sucotronic / gist:6009576
Created July 16, 2013 15:07
m80 commands
# lista de canciones curl -s "http://playerservices.streamtheworld.com/public/nowplaying?mountName=M80RADIO&numberToFetch=10&eventType=track" | xmllint --xpath '//nowplaying-info-list/nowplaying-info[1]/property[@name="track_artist_name"]/text()' --nocdata -
#cue_time_start está en milisegundos desde epoch
date --date='@1373986371'
#streams disponibles
curl -s "http://playerservices.streamtheworld.com/api/livestream?version=1.5&mount=M80RADIOAAC&lang=es&nobuf=1373975014724"
curl -s http://www.mejortorrent.com/secciones.php?sec=ultimos_torrents | iconv -f iso-8859-1 -t utf8 | tidy -f /dev/null -asxhtml | sed "s/ //g" | sed "s/xmlns/ignore/" |xmllint --format --recover --xpath "/html/body/table/tr[3]/td/table/tr/td[2]/table/tr/td/table/tr/td/table/tr/td/a" -
@sucotronic
sucotronic / m80.sh
Created July 31, 2013 13:40
reproductor de radio online de m80
#!/bin/bash
NUM=0
while [ $NUM -lt 10 ]; do
ARRAY=( `curl -s "http://playerservices.streamtheworld.com/api/livestream?version=1.5&mount=M80RADIOAAC&lang=es&nobuf=1373975014724" | sed 's% xmlns="http://provisioning.streamtheworld.com/player/livestream-1.5"%%' | xmllint --xpath "//server/@sid" - | sed 's/sid=//g' | sed 's/"//g' ` )
N=`shuf --input-range=0-$(( ${#ARRAY[*]} - 1 )) | head -1`
mplayer -cache 200 -cache-min 50 http://${ARRAY[$N]}.live.streamtheworld.com/M80RADIOAAC
NUM=`expr $NUM + 1`
sleep 5
done
@sucotronic
sucotronic / kissfm
Created September 17, 2013 09:28
play kissfm radio
rtmpdump -r "rtmp://kissfm.es.flash3.glb.ipercast.net/kissfm.es-live" -a "kissfm.es-live" -f "LNX 11,2,202,310" -W "http://www.kissfm.es/player/mananasplayer/player.swf" -p "http://www.kissfm.es/player/mananasplayer/index.php" -y "aac.stream" --live -b 10000 | mplayer -
@sucotronic
sucotronic / sendRaw.sh
Created September 18, 2013 14:28
send raw bytes (have to bin hex) by UDP to an ip and port
#!/bin/bash
echo -n 022364018095 | perl -pe 's/([0-9a-f]{2})/chr hex $1/gie' | nc -4u -q1 -p5001 192.168.0.100 5000
@sucotronic
sucotronic / tkinter_pygame.py
Created September 24, 2013 15:54
stub about tkinter and pygame
from Tkinter import *
import threading
import pygame
master = Tk()
v = StringVar()
def callback():
print "click!"
v.set("clicao!!")
#!/bin/sh
rtmpdump -r "rtmp://ondacerogeofms35livefs.fplive.net:1935/ondacerogeofms35live-live" -a "ondacerogeofms35live-live" -f "LNX 11,2,202,310" -W "http://www.ondamelodia.es/swf/AUPlayer.swf" -p "http://www.ondamelodia.es/" -y "stream-ondamelodia" --live -b 10000 | mplayer -cache 400 -cache-min 50 -af volnorm=2 -
@sucotronic
sucotronic / kreta3.sh
Created November 22, 2013 17:13
sends broadcast packet to discover Kreta2 kimaldi devices on a network
# Broadcast message to discover if there are kimaldi Kreta3 devices on a network
echo -n 01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 | perl -pe 's/([0-9a-f]{2})/chr hex $1/gie' | socat - UDP-DATAGRAM:255.255.255.255:2000,broadcast,sourceport=2001
import cv2
import numpy as np
canny = rho = threshold = minLen = maxGap = None
def draw():
lines = cv2.HoughLinesP(canny, rho, np.pi / 180,
threshold, None, minLen, maxGap)
dst = cv2.cvtColor(canny, cv2.COLOR_GRAY2BGR)