sudo curl "http://phildawson.co.uk/ssh-copy-id" -o /usr/bin/ssh-copy-id
sudo chmod +x /usr/bin/ssh-copy-id
ssh-copy-id -i ~/.ssh/id_rsa.pub user@host
ssh-copy-id -i ~/.ssh/id_rsa.pub "user@host -p 8129"
View linebyline.js
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
var fs = require('fs'); | |
var readline = require('readline'); | |
var stream = require('stream'); | |
var instream = fs.createReadStream('test.txt', 'utf8'); | |
var outstream = new stream; | |
var rl = readline.createInterface(instream, outstream); | |
var obj = {} | |
rl.on('line', function (line) { |
View SSHwithoutPassword.md
View checkout_remote_branch.sh
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
git checkout --track origin/daves_branch |
View keybind.sublime-map
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
[ | |
{ "keys": ["alt+super+t"], "command": "insert_snippet", "args": {"name": "Packages/User/mako-translate.sublime-snippet"} } | |
] |
View Sort list by key.py
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
from operator import itemgetter | |
newList = sorted(listToSort, key=itemgetter('key')) |
View Perform an operation on each dictionary value.py
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
my_dict.update((x, y*2) for x, y in my_dict.items()) |
View mount_ntfs_usb_to_read_write.md
Step 1
$ mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
View ex_prime.py
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 -*- | |
for n in range(2, 100): | |
for i in range(2, n): | |
if n % i == 0: | |
break | |
else: | |
print '{} is a prime!'.format(n) |
View ex_csv.py
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 csv | |
with open('sample_data.csv') as f: | |
for row in csv.reader(f): | |
print row |
View dict_setdefault.py
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
# prefer | |
def _addErr1(errors, field, message): | |
errors.setdefault(field, []).append(message) | |
# not prefer | |
def _addErr2(errors, field, message): | |
if not field in errors: | |
errors[field] = [] | |
errors[field].append(message) |
OlderNewer