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
#=============================================================================== | |
# | |
# FILE: filename.sh | |
# | |
# USAGE: filename.sh [Options] [Arguments] | |
# | |
# DESCRIPTION: describe the purpose of this program. | |
# | |
# OPTIONS: see function ’usage’ below | |
# REQUIREMENTS: --- |
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
#--- FUNCTION ---------------------------------------------------------------- | |
# NAME: usage | |
# DESCRIPTION: Display usage information for this script. | |
# PARAMETER 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
# -*- coding: utf-8 -*- | |
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 -*- | |
import socket | |
target_host = "127.0.0.1" | |
target_port = 80 | |
# create a socket object | |
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
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 -*- | |
import socket | |
target_host = "127.0.0.1" | |
target_port = 80 | |
# create a socket object | |
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
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 python2 | |
# -*- coding: utf-8 -*- | |
def bin2dec(binary_string): | |
""" Convert binary string to decimal number """ | |
decimal = 0 | |
while binary_string: | |
decimal = decimal * 2 + (ord(binary_string[0]) - ord('0')) | |
binary_string = binary_string[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
A = Y if X else Z |
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
[ expression for item in list if conditional ] |
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 python2 | |
# -*- coding: utf-8 -*- | |
import sys | |
tokenizedInput = sys.stdin.read().split() |
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 python2 | |
# -*- coding: utf-8 -*- | |
def primes(n): | |
""" Returns a list of primes < n """ | |
sieve = [True] * n | |
for i in xrange(3,int(n**0.5)+1,2): | |
if sieve[i]: | |
sieve[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1) |
OlderNewer