Skip to content

Instantly share code, notes, and snippets.

View bahrmichael's full-sized avatar

Michael Bahr bahrmichael

View GitHub Profile
@bahrmichael
bahrmichael / node-and-npm-in-30-seconds.sh
Created December 2, 2015 08:57 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
Assuming you are running an Ubuntu 14.04. Do all the following as root.
1. Install Docker: curl -sSL https://get.docker.com/ | sh
2. Download and start webserver with: docker run -d -p 80:80 --name webserver tutum/nginx
3. Access the webserver at: <IP> (e.g. 172.17.0.45)
4. See a hello world message (with tutum logo above).
5. Access it multiple times from different devices.
6. Shut down the webserver with: docker rm -f webserver

Written for Ubuntu 14.04. Adjust accordingly.

  • Update the cache with sudo apt-get update
  • Install git with sudo apt-get install git
  • Get the source code with git clone https://github.com/bahrmichael/tabap.git
  • Install pip with sudo apt-get install python-pip. We need this to install docker-compose.
  • Install docker-compose with sudo pip install docker-compose.
  • Install the mysql client with sudo apt-get install mysql-client-5.6
  • Navigate into folder with docker-compose.yml file: cd tabap.
  • Run docker-compose up -d --force-recreate.
test
@bahrmichael
bahrmichael / app.py
Created January 29, 2017 17:50
Test ccp api speed
from datetime import datetime
import evelink
class App:
eve = evelink.eve.EVE()
def main(self):
def handle(event, context):
print('Received %d records' % len(event['Records']))
for record in event['Records']:
# as we're using ttl to schedule executions, we do not care about inserts or updates,
# only about removes which happen after the ttl is hit
event_name = record['eventName']
if event_name != 'REMOVE':
print('Skipping %s' % event_name)
continue
{
"a_number": {"N": "12345"},
"a_string": {"S": "Hello World!"}
}
import boto3
import time
from uuid import uuid4
# keep the db initialization outside of the functions to maintain them as long as the container lives
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
scheduling_table = dynamodb.Table('lambda-scheduling')
service: lambda-scheduler
provider:
name: aws
runtime: python3.7
iamRoleStatements:
- Effect: Allow
Action:
# Please limit the Actions to read and write if you use this in production
- dynamodb:*
Group Delay in seconds
Scheduled Events 1000
Executed Events 1000
Maximum 791
Minimum 485
Average 636
Median 633
Percentile 0.99 784
Percentile 0.95 772
Percentile 0.90 757