Skip to content

Instantly share code, notes, and snippets.

View cnDelbert's full-sized avatar

Delbert cnDelbert

View GitHub Profile
@cnDelbert
cnDelbert / unsplash.py
Last active November 15, 2017 02:08
一个简单的unsplash全站下载脚本。 使用Python3及BeautifulSoup4。
# -*- coding:utf-8 -*-
__author__ = 'Delbert'
# Using Python3
# beautifulsoup4 is needed.
from bs4 import BeautifulSoup
from urllib import request
import os
def main():
begin_page = int(input("From: "))
@cnDelbert
cnDelbert / is_prime.py
Created October 15, 2014 05:52
Return True if n is a prime number otherwise return False
def is_prime(n):
'Return True if n is a prime number otherwise return False'
if n == 0 or n == 1:
return False
else:
for i in range(2, n):
if n%i == 0:
return False
return True
@cnDelbert
cnDelbert / SyntaxHighlighterJS.py
Created October 24, 2014 14:13
Download all js and css files from SyntaxHighlighter
# coding:utf-8
# Python 3.4
# Download all js and css files from SyntaxHighlighter
# __author__ = Delbert
from urllib import request
url_arr = ["http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css",
"http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js",
"http://alexgorbatchev.com/pub/sh/current/scripts/shAutoloader.js",
"http://alexgorbatchev.com/pub/sh/current/scripts/shBrushAS3.js",
@cnDelbert
cnDelbert / Panorama pics from Google.py
Last active August 29, 2015 14:08
Modify the path to save and the url which obtained, the script can download the pictures and paste them into one. The two files fit different URL formats.
# -*- coding:utf-8 -*-
__author__ = 'Delbert'
# for Python 3.4 and Python 2.7
# Pillow and request module are needed
import requests
import os
from PIL import Image
save_path = "notre-dame-cathed1"
@cnDelbert
cnDelbert / QrCode Bookmark-sae.js
Last active August 29, 2015 14:12
Click the bookmark to generate the QrCode. Click on the image of the QrCode to destory it.
javascript:((function(){document.body.innerHTML=document.body.innerHTML+"<div%20id='MyQrCode'%20style='display:block;z-index:99999;position:fixed;top:0;right:0;'%20onclick='javascript:(function(){var%20MyQrCode=document.getElementById(&quot;MyQrCode&quot;);MyQrCode.parentNode.removeChild(MyQrCode);}())'><img%20src='http://png.2vma.theucd.com/chart?chl="+escape(document.location.href)+"&chs=200x200&cht=qr&chld=%7C1&choe=UTF-8'></div>";})());
@cnDelbert
cnDelbert / How to install tcpping on Linux.md
Last active March 18, 2024 14:27
How to install tcpping on Linux

To install tcptraceroute on Debian/Ubuntu:

$ sudo apt-get install tcptraceroute

To install tcptraceroute on CentOS/REHL, first set up RepoForge on your system, and then:

$ sudo yum install tcptraceroute
@cnDelbert
cnDelbert / DownTraverse.py
Last active August 29, 2015 14:13
Download files from an http server which allows traversing.
# -*- coding: utf-8 -*-
__author__ = 'Delbert'
# Download files from an http server which allows traversing.
# Python 3 Only.
# requests and BeautifulSoup4 are required.
from bs4 import BeautifulSoup
import urllib
import requests
import os
@cnDelbert
cnDelbert / java_install_sp.txt
Created January 25, 2015 11:53
Java Install Log
Sun Jan 25 19:41:15 2015
::
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sun Jan 25 19:41:15 2015
:: ----------------------------------------------
Sun Jan 25 19:41:15 2015
:: GetSponsorOffer(), started 1/25/2015 at 11:41
@cnDelbert
cnDelbert / refFormatter.py
Created January 31, 2015 13:50
Format references to the given format.
# -*- coding: utf-8 -*-
__author__ = 'Delbert'
import re
import xlwt
def parse(refer, formated):
r_file = open(refer, 'rt', encoding='utf-8')
save_file = open('saved.txt', 'wt', encoding='utf-8')
@cnDelbert
cnDelbert / SimpleDesktops.py
Last active August 29, 2015 14:14
Download images from SimpleDesktops.com .
# -*- coding: utf-8 -*-
__author__ = 'Delbert'
# You can pass 2 parameters to init_config()
# `path` is the directory you would like to save the images
# `image_id` is the image ID you want to download from.
from bs4 import BeautifulSoup
import requests
import os