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
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
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
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
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
l0 = {} | |
l1 = l0.setdefault("key_l1", {}) | |
l2 = l1.setdefault("key_l2", []) | |
l2.append("3") | |
{'key_l1': {'key_l2': ['3']}} |
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
# Write this: | |
if (mark.a, mark.b) == (region.a, region.b): | |
... | |
# much cleaner than: | |
if mark.a == region.a and mark.b == region.b: | |
... |
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 get_active_view(self): | |
"""Return the active view in the currently active window.""" | |
return sublime.active_window().active_view() |
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
>>> ["foo", "bar", "baz"].index("bar") | |
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
import bisect | |
def get_neighbours(num, interval): | |
interval = set(interval) | |
interval.discard(num) | |
interval = list(interval) | |
interval.sort() | |
if num < interval[0] or interval[-1] < num: |