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
'use latest'; | |
import bodyParser from 'body-parser'; | |
import express from 'express'; | |
import Webtask from 'webtask-tools'; | |
import { MongoClient } from 'mongodb'; | |
import { ObjectID } from 'mongodb'; | |
const collection = 'tasks'; | |
const server = express(); |
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
'use latest'; | |
import sendgrid from 'sendgrid'; | |
import { MongoClient } from 'mongodb'; | |
const helper = sendgrid.mail; | |
const collection = 'users'; | |
/** | |
* @param context {WebtaskContext} | |
*/ | |
const sendReminder = function(context, cb, user) { |
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
# Installing (on both servers) | |
apt update && apt -y upgrade && | |
apt install -y wget build-essential && | |
wget https://github.com/HewlettPackard/netperf/archive/netperf-2.7.0.tar.gz && | |
tar -zxvf netperf-2.7.0.tar.gz && | |
cd netperf-netperf-2.7.0/ && | |
./configure && make && make install | |
# Run only at server | |
netserver |
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
#!/bin/sh | |
# | |
# Command examples: | |
# time ./write.sh | |
# time ./write.sh 1000 | |
# | |
# This will print time taken (default test, max=100000) | |
# real 0m1.258s | |
# user 0m0.816s | |
# sys 0m0.438s |
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
# Reason for choosing cherrypy | |
# https://blog.appdynamics.com/engineering/a-performance-analysis-of-python-wsgi-servers-part-2/ | |
# | |
# Flask application based on Quickstart | |
# http://flask.pocoo.org/docs/0.12/quickstart/ | |
# | |
# CherryPy documentation for this | |
# http://docs.cherrypy.org/en/latest/deploy.html#wsgi-servers | |
# http://docs.cherrypy.org/en/latest/advanced.html#host-a-foreign-wsgi-application-in-cherrypy | |
# Install: pip install cherrypy |
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 urllib2 | |
link = "http://example.com" | |
r = urllib2.Request(url=link) | |
# r.add_header('Cookie', 'sessionid=13cxrt4uytfc6ijvgeoflmb3u9jmjuhil; csrftoken=jdEKPN8iL62hdaq1hmMuID9DMALiiDIq') | |
r.add_header('Upgrade-Insecure-Requests', '1') | |
r.add_header('Accept-Encoding', 'gzip, deflate, sdch, br') | |
r.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36') | |
r.add_header('Connection', 'keep-alive') | |
r.add_header('Cache-Control', 'max-age=0') |
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
# Install Cassandra on Ubuntu | |
# Source: https://www.digitalocean.com/community/tutorials/how-to-install-cassandra-and-run-a-single-node-cluster-on-ubuntu-14-04 | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java8-set-default | |
echo "deb http://www.apache.org/dist/cassandra/debian 22x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list | |
echo "deb-src http://www.apache.org/dist/cassandra/debian 22x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list | |
gpg --keyserver pgp.mit.edu --recv-keys F758CE318D77295D |
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
# Install pip on Ubuntu | |
# Source: http://www.saltycrane.com/blog/2010/02/how-install-pip-ubuntu/ | |
sudo apt-get install python-pip python-dev build-essential | |
sudo pip install --upgrade pip | |
sudo pip install --upgrade virtualenv |
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 time import gmtime, strftime | |
import urllib2 | |
import hmac | |
import hashlib | |
import base64 | |
""" | |
Code to generate signed URL for Amazon Associate | |
I hope it is simple to understand |
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 outputArray = []; | |
var content = fs.readFileSync('map.txt').toString('utf8'); | |
var lines = content.split('\n'); | |
lines.forEach(function(line){ | |
var cells = line.split(' '); | |
var newArray = []; | |
cells.forEach(function(cell){ | |
newArray.push(parseInt(cell)); |
NewerOlder