- Disk failures: http://static.googleusercontent.com/media/research.google.com/en//archive/disk_failures.pdf
- Databases architecture: http://db.cs.berkeley.edu/papers/fntdb07-architecture.pdf
- Dynamo DB http://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf
- Google File System http://static.googleusercontent.com/media/research.google.com/en//archive/gfs-sosp2003.pdf
- Pub sub architecture http://people.mpi-inf.mpg.de/~vsetty/Setty_Phd_Thesis.pdf
- Pub usb spotify https://www.csc.kth.se/~gkreitz/spotifypubsub/spotifypubsub.pdf
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
# flush existing rules | |
iptables -F | |
ip6tables -F | |
# ssh rule. always add this first ! | |
# TODO: Consider rate limiting? (e.g http://www.digitalsanctuary.com/tech-blog/debian/using-iptables-to-prevent-ssh-brute-force-attacks.html) | |
# Still need to read up on implications... | |
iptables -A INPUT -p tcp --dport ssh -j ACCEPT | |
iptables -A OUTPUT -p tcp --sport ssh -j ACCEPT |
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
# flush existing rules | |
iptables -F | |
ip6tables -F | |
# ssh rule. always add this first ! | |
# TODO: Consider rate limiting? (e.g http://www.digitalsanctuary.com/tech-blog/debian/using-iptables-to-prevent-ssh-brute-force-attacks.html) | |
# Still need to read up on implications... | |
iptables -A INPUT -p tcp --dport ssh -j ACCEPT | |
iptables -A OUTPUT -p tcp --sport ssh -j ACCEPT |
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
aws s3 mb s3://test-website | |
aws s3 website s3://test-website --index-document index.html --error-document error.html | |
echo '{"Version":"2012-10-17", "Statement": [{ "Sid": "Allow Public Access to All Objects", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::test-website/*"}]}' > policy.json | |
aws s3api put-bucket-policy --bucket test-website --policy file://policy.json | |
aws s3 sync website-source-folder s3://test-website |
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
## solution 1 using arrays | |
# import sys | |
# line = sys.stdin.readline().strip() | |
# linearr = [] | |
# for c in line: | |
# linearr.append(c) | |
# # print linearr |
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
import sys | |
T = int(sys.stdin.readline().strip()) | |
xor_bits = (1 << 32) - 1 | |
for i in xrange(T): | |
N = int(sys.stdin.readline().strip()) | |
print N ^ xor_bits |
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
// setup | |
1. if you want the worker to be in a separate project and separately deployed: heroku create <projectname> | |
2. if separate project created in step 1: heroku addons:attach <addonname> | |
// subscriber | |
var redis = require('redis'); | |
var RedisChannels = require('./constants/redisChannels') |
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
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"userName": "ryan", "platform":"android", "pushToken":"egO6G6CoxZE:APA91bFqN90Lb0n4TfNC02dXJ0vMT7uQ33WqFBG_FU5AC1dW_5PX1t9yFdA6gBxG_THDHdkkFdSZXq05PCABiIfAHUhu9ky-4vq8MOJdMUIZ1p4RvwiTVcAqnBGi3je19cO7TporEgjx"}' http://localhost:8082/users/ |
mongo:
mongod
redis:
redis-server
rabbit:
rabbitmq-server
ES:
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
show dbs // list all indexes | |
use <db> | |
show collections | |
db.collection.find(<query>) // find given optional query | |
db.directmessages.remove({}) // delete all | |
> use mydb; | |
> db.dropDatabase(); | |
db.foo.update({}, {$set: {lastLookedAt: Date.now() / 1000}}, { multi: true } // update all |
OlderNewer