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
from itertools import cycle | |
lst = ['a', 'b', 'c'] | |
pool = cycle(lst) | |
for item in pool: | |
print(item) |
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
mydict.pop("key", None) |
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
old_string = "this is going to have a full stop. some written sstuff!" | |
k = old_string.rfind(".") | |
new_string = old_string[:k] + ". - " + old_string[k+1:] |
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
Don't use a password. Generate a passphraseless SSH key and push it to your VM. | |
If you already have an SSH key, you can skip this step… Just hit Enter for the key and both passphrases: | |
$ ssh-keygen -t rsa -b 2048 | |
Generating public/private rsa key pair. | |
Enter file in which to save the key (/home/username/.ssh/id_rsa): | |
Enter passphrase (empty for no passphrase): | |
Enter same passphrase again: | |
Your identification has been saved in /home/username/.ssh/id_rsa. |
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
# list remotes | |
git remote -v | |
# add remote | |
git remote add upstream https://github.com/SublimeLinter/SublimeLinter3.git | |
# sync with main repo | |
git pull upstream master |
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
git add * | |
git status -s | |
git commit -m "YOUR COMMIT MESSAGE" | |
git push origin feature_name |
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
l = ['Your Code Here'] | |
t = ('Your Code Here') | |
for item in l: | |
print(item) | |
for item in t: | |
print(item) | |
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
>>> a = 1 | |
>>> (a==1) + (a>0) + (a==2) | |
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
sudo xed ~/.netrc | |
machine github.com | |
login USER_NAME | |
password ACCESS_TOKEN | |
machine api.github.com | |
login USER_NAME | |
password ACCESS_TOKEN |
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
except ValueError as err: | |
err.strerror = "New error message" | |
raise err |