This file contains hidden or 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 | |
# Create ftp user, create folders and set permissions | |
# Shamelessly coppied from http://dev.n0ise.net/2012/09/vsftpd-add-user-automation-bash-script/ | |
# Usage: ./create_ftp_user.sh [username] "[password]" | |
# | |
NAME=$1 | |
PASS=$2 |
This file contains hidden or 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
def lis(a): | |
L = [] | |
for (k,v) in enumerate(a): | |
L.append(max([L[i] for (i,n) in enumerate(a[:k]) if n<v] or [[]], key=len) + [v]) | |
return max(L, key=len) | |
inp = [int(a) for a in input("List of integers: ").split(' ')] | |
print(lis(inp)); |
This file contains hidden or 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 Hangman(): | |
def __init__(self): | |
print "Welcome to 'Hangman', are you ready to die?" | |
print "(1)Yes, for I am already dead.\n(2)No, get me outta here!" | |
user_choice_1 = raw_input("->") | |
if user_choice_1 == '1': | |
print "Loading nooses, murderers, rapists, thiefs, lunatics..." | |
self.start_game() | |
elif user_choice_1 == '2': |
This file contains hidden or 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
1) Create a branch with the tag | |
git branch {tagname}-branch {tagname} | |
git checkout {tagname}-branch | |
2) Include the fix manually if it's just a change .... | |
git add . | |
git ci -m "Fix included" | |
or cherry-pick the commit, whatever is easier | |
git cherry-pick {num_commit} | |
This file contains hidden or 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
def format_time(secs): | |
return "%d:%02d" % (secs / 60, secs % 60) | |
def invert(arr): | |
""" | |
Make a dictionary that with the array elements as keys and | |
their positions positions as values. | |
>>> invert([3, 1, 3, 6]) |
NewerOlder