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/python | |
import nmap | |
# python-nmap url : http://xael.org/norman/python/python-nmap/python-nmap-0.1.4.tar.gz | |
nm = nmap.PortScanner() | |
nm.scan(hosts='192.168.1.0/24', arguments='-n -p 161 -sU ') | |
hosts_list = [(x, nm[x][u'udp'][161]['state']) for x in nm.all_hosts()] | |
#print nm.all_hosts() | |
#print nm[u'192.168.1.100'][u'udp'][161]['state'] |
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/python | |
import smtplib,re,urllib2,time | |
import socket | |
from subprocess import Popen, PIPE | |
smtpServer='smtp.163.com' | |
smtpPort='25' | |
sender = '[email protected]' | |
senderPasswd = "XXXXX" |
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/python | |
''' | |
CentOS 6.2 + Python 2.6 | |
''' | |
def getIpList(): | |
import os | |
ipList = [] | |
var = os.popen('ifconfig').read().split("\n\n") | |
for item in var: |
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
#include <iostream> | |
#include <iterator> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
int main() | |
{ | |
istream_iterator<int> cin_it(cin); |
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
#! /bin/bash | |
r_host='10.11.1.100' | |
if [ -f '/usr/bin/watch' ] | |
then | |
watch -n 1 -d "netstat -an | grep $r_host" | |
else | |
while [ 1 ] | |
do |
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
#! /bin/bash | |
t1=`date +%Y%m%d%H%M` | |
path1="/tmp/out_$t1.mpg" | |
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq $path1 |
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
#include <map> | |
#include <string> | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
map<string,int> dict; | |
string word; |
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/python | |
import socket,time,string,random,thread | |
m_Vars = { | |
"bufLen" : 1024 * 10, | |
"defaultServerIp" : "192.168.1.100", | |
"defaultServerPort" : 554, | |
"defaultTestUrl" : "rtsp://192.168.1.100/test1.mp4", | |
"defaultUserAgent" : "LibVLC/2.0.3 (LIVE555 Streaming Media v2011.12.23)" |
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
#include <iostream> | |
using namespace std; | |
//using pointer | |
void ptrSwap1(int **pa,int **pb) | |
{ | |
int *ptmp = *pa; | |
*pa = *pb; | |
*pb = ptmp; |
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
#include <iostream> | |
//#define NDEBUG // or : g++ -DNDEBUG debugTest.cpp -o debugTest | |
#include <cassert> | |
using namespace std; | |
int main() | |
{ | |
cout<<__FILE__<<endl; | |
cout<<__LINE__<<endl; |