this shows a simple way to make code syntax highlighter on blogger.com.
on blog administration, goto :
1. template
2. edit html button
3. before the head put :
Than when you need to put a source example make:
all code here
Than when you need to put a source example make:
all code here
"""
downloadAllPdfs.py
Downloads all the pdf on the supplied URL, and saves them to the
specified output file ("/test/" by default)
Usage:
python downloadAllPdfs.py http://example.com/ [output]
"""
from bs4 import BeautifulSoup
import urllib.request as urllib2
import http.cookiejar
import sys
def _downloadFileFromServer(finalFileUri,outputpath):
print("==> _downloadFileFromServer %s" % finalFileUri )
filename=finalFileUri.rsplit('/', 1)
cj = http.cookiejar.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
page = opener.open(finalFileUri)
data = page.read()
page.close()
opener.close()
print("==> _downloadFileFromServer %s" % outputpath+filename[1] )
FILE = open(outputpath+filename[1], "wb")
FILE.write(data)
FILE.close()
def _downloadFolder(url,outputpath):
print("\tdownload %s" % url )
cj = http.cookiejar.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
page = opener.open(url)
soup = BeautifulSoup(page)
#print (soup.prettify(None,"minimal"))
for lnk in soup.findAll("a"):
print ("\t\tcheck lnk %s" % lnk)
if lnk.has_attr('href'):
filename = lnk["href"]
else:
continue
if filename is None:
continue
if filename.find(".pdf") >=0 or filename.find(".zip") >=0 :
finalFile=filename
if filename.find("http://")<0 :
finalFile=url + filename
_downloadFileFromServer(finalFile,outputpath)
print("DONE download %s" % url )
print("" )
def main():
print ("==init==")
url=sys.argv[1]
outputpath=sys.argv[2]+"\\"
print ("download from %s"%url)
print ("to %s"%outputpath)
_downloadFolder(url,outputpath)
print ("==done==")
if __name__ == "__main__":
main()
'''
Created on 23/01/2016
@author: tecbea
'''
# import gpio
import RPi.GPIO as GPIO
# import time
import time
def _ledLoop (io,num,sleep):
for num in range(1,num):
print "io %d on" % io
GPIO.output(io,GPIO.HIGH)
time.sleep(sleep)
print "io %d off" % io
GPIO.output(io,GPIO.LOW)
time.sleep(sleep)
def main():
print ("==init==")
# set mode on gpio 18
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# output mode
GPIO.setup(17,GPIO.OUT)
GPIO.setup(18,GPIO.OUT)
_ledLoop(17,10,0.5);
_ledLoop(18,10,0.5);
_ledLoop(17,20,0.1);
_ledLoop(18,20,0.1);
# ###############################
if __name__ == "__main__":
main()
| pub | Number Subs | Total Ops | Time ms | Op/sec |
| 1 | 5 | 500000 | 2955 | 169204.7377 |
| 1 | 5 | 1000000 | 4570 | 218818.3807 |
| 1 | 10 | 500000 | 4408 | 113430.127 |
| 1 | 10 | 1000000 | 7478 | 133725.5951 |
| 1 | 20 | 500000 | 7479 | 66853.85747 |
| 1 | 20 | 1000000 | 12711 | 78672.01636 |
Hi there how many times we have fuckin stupid commentaries of , hey the code has a password... bullshit you can always get the password... ...