- lxml - Pythonic binding for the C libraries libxml2 and libxslt.
- boto - Python interface to Amazon Web Services
- Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
- Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
- PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
- Celery - Task queue to distribute work across threads or machines.
- pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
#author:hellosec via http://www.zhihu.com/question/23031778 | |
#instructions:only text(time & position omitted) | |
import os | |
note_path='/Volumes/Kindle/documents/My Clippings.txt' | |
f=open(note_path,'r+') | |
digest_path='/Users/yangxin/Desktop/digest/' | |
os.mkdir(digest_path) | |
while True: | |
onenote=[] |
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/env python | |
#coding:utf-8 | |
# author : wzx, 2123409 | |
# date: Dec 14, 2014 | |
# kruskal : graph{vertices,edge} -> set([weight,vertices]) | |
# to find a minimum spanning tree for a connected weighted graph | |
# algorithm | |
# example: kruskal(graph) | |
# graph:(4, 'A', 'B'),(8, 'A', 'C'),(15, 'A', 'D'),(16, 'B', 'C'),(23, 'B', 'D'),(42, 'C', 'D') |
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
# Given n processes, each process has a unique PID (process id) and its PPID (parent process id). | |
# Each process only has one parent process, but may have one or more children processes. | |
# This is just like a tree structure. Only one process has PPID that is 0, | |
# which means this process has no parent process. All the PIDs will be distinct positive integers. | |
# We use two list of integers to represent a list of processes, | |
# where the first list contains PID for each process and the second list contains the corresponding PPID. | |
# Now given the two lists, and a PID representing a process you want to kill, |
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
class Solution(object): | |
def findSubsequences(self, nums): | |
""" | |
:type nums: List[int] | |
:rtype: List[List[int]] | |
""" | |
dp = set() | |
for n in nums: | |
for y in list(dp): | |
if n >= y[-1]: |
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
# Time: O(n) | |
# Space: O(1) | |
# 31 Next Permutation | |
# Edge case | |
''' | |
https://www.nayuki.io/res/next-lexicographical-permutation-algorithm/next-permutation-algorithm.png | |
''' | |
class Solution(object): | |
def nextPermutation(self, nums): |
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
# Time: O(n!) | |
# Space: O(n!) | |
# 46. Permutations | |
class Solution(object): | |
def permute(self, nums): | |
""" | |
:type nums: List[int] |
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
# Time: O(n) | |
# Space: O(1) | |
# 3. Longest substring without repeating characters | |
class Solution(object): | |
def lengthOfLongestSubstring(self, s): | |
""" | |
:type s: str | |
:rtype: int |
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
# Time: O(n) | |
# Space: O(1) | |
# 11. Container With Most Water | |
class Solution(object): | |
def maxArea(self, height): | |
""" | |
:type height: List[int] | |
:rtype: int |
OlderNewer