Skip to content

Instantly share code, notes, and snippets.

@tywtyw2002
tywtyw2002 / termcount
Created March 25, 2014 08:46
termcount
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# work with python 2.7
import curses
import time
import sys
color = 2
space = '\x1b[48;5;%dm \x1b[0m' % color
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# work with python 2.7
# Author: Landon@CosHiM <[email protected]>
# Version: 0.1 Beta
import urllib2
import re
import sys
curl -x 127.0.0.1:5203 http://hot.vrs.sohu.com/ipad1406916_4619571893905_4617237.m3u8
#EXTM3U
#EXT-X-TARGETDURATION:30
#EXT-X-VERSION:3
#EXTINF:7.759,
http://220.181.61.229/ipad?file=/60/81/YrQ60nrYyBtPFrCCSAcyj6.mp4&start=0&end=7.679&ch=tv&cateCode=101104;101106;101121&uid=null&plat=null&pt=-1&pg=null&vid=1406916&eye=0&sig=UL6geJYn4etegwZ1NduiB-6QfUuGpfNm
#EXTINF:25.161,
http://220.181.61.229/ipad?file=/60/81/YrQ60nrYyBtPFrCCSAcyj6.mp4&start=7.679&end=32.84&ch=tv&cateCode=101104;101106;101121&uid=null&plat=null&pt=-1&pg=null&vid=1406916&eye=0&sig=UL6geJYn4etegwZ1NduiB-6QfUuGpfNm
#EXTINF:26.159,
http://220.181.61.229/ipad?file=/60/81/YrQ60nrYyBtPFrCCSAcyj6.mp4&start=32.84&end=58.999&ch=tv&cateCode=101104;101106;101121&uid=null&plat=null&pt=-1&pg=null&vid=1406916&eye=0&sig=UL6geJYn4etegwZ1NduiB-6QfUuGpfNm
@tywtyw2002
tywtyw2002 / gist:18c83dc89aab48a41d3c
Last active August 29, 2015 14:10
automation test
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
# work with python 2.7
import subprocess
import select
import Queue
Task_Queue = Queue.Queue()
@tywtyw2002
tywtyw2002 / bash
Created November 26, 2014 21:25
check gem5 run
#!/bin/sh
seq 2 32 | xargs printf %02d\\n | while read line
do
echo ug$line
ssh -n ug$line "ps aux | grep gem5.opt | grep -v grep"
done
@tywtyw2002
tywtyw2002 / gist:9d09e22536c661fde556
Last active August 29, 2015 14:10
Get ip block from several ip address
from functools import reduce
from math import log, ceil
def x(ip):
ip_set = ip.split(".")
int_ip = sum([int(ip_set[-i]) << (i - 1) * 8 for i in xrange(1, 5)])
return int_ip
def r_x(int_ip):
return "%d.%d.%d.%d" % ((int_ip & 0xFF000000) >> 24,
# Poker II Firmware disassembly help tool.
original = IO.read("./Poker II original firmware.bin")
extracted = ""
original.each_byte{|b|
m = (((b & 0x0f) << 4) | ((b & 0xf0) >> 4)) ^ 0xff
extracted << m.chr
}
puts extracted
import socket
import struct
import time
UDP_IP = "127.0.0.1"
UDP_PORT = 9880
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
[{u'count': 1,
u'posts': [{u'author': {u'displayname': u'pmaidens',
u'github': u'github.com/pmaidens',
u'host': u'example.com',
u'id': u'e8d08d8e-c161-49e2-a60b-0e388f246a46',
u'url': u'example.com/author/e8d08d8e-c161-49e2-a60b-0e388f246a46'},
u'categories': [],
u'comments': [],
u'content': u'lol',
u'contentType': u'plain',
#EXTM3U
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:10
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:300.0,
http://70.39.188.1/sohu/v1/TmwBqAItfhcXe41VTSsGNeENPA0RoBA7P2b60A9Llm47fFoGRMNiNw.mp4?k=TBOG6K&p=XWPIWho70ScAZMoUoTWCr&r=TmI20LscWOo70Sc2ZDASqTPGRDbtWDoioMycY&q=OpC3hW7IWh1Soh24WhoGgT1cWB1HfBbHfhAXlGyOwmbcWJbXfGvsfJbSqD24fOoUZDJ&cip=70.74.199.72
#EXTINF:300.0,
http://70.39.188.7/sohu/v1/TmPCoKItfDc6NewUy6EFD66UP2seqAvDzYWVqSNF5m47fFoGRMNiNw.mp4?k=owXmFK&p=XWPIWho70ScAZMoUoTWCr&r=TmI20LscWOo70Sc2ZDASqTPGRDbtWDoioMycY&q=OpC7hW7IWh1Soh24WhoGgT1cWB1HfBbHfhAXlGyOwmbcWJbXfGvsfJbSqD2ORhoUZDJ&cip=70.74.199.72
#EXTINF:300.0,