My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import os | |
import requests | |
from bs4 import BeautifulSoup | |
import glob | |
from PyPDF2 import PdfFileMerger | |
#Todo: debug this function |
We prefer to have audit logging in our services that leverage databases. It gives us clarity into sources of where ACL issues might originate as well as gives us a general timeline of activity in our application.
Audit logging is tedious to set up so this gist contains our latest iteration of audit logging support for a sequelize based service.
#!/bin/bash | |
#set -e | |
# origin-source: http://www.fars-robotics.net/install-wifi | |
# install-wifi - v9.4 - by MrEngman. | |
# After downloading this script: | |
# $ sudo mv ./install-wifi /usr/bin/install-wifi | |
# $ sudo chmod +x /usr/bin/install-wifi | |
# $ sudo install-wifi -h | |
# |
I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.
So it might be really unintuitive at first but lambda functions have three states.
- No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
- VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
- VPC with NAT, The best of both worlds, AWS services and web.
Around 2006-2007, it was a bit of a fashion to hook lava lamps up to the build server. Normally, the green lava lamp would be on, but if the build failed, it would turn off and the red lava lamp would turn on.
By coincidence, I've actually met, about that time, (probably) the first person to hook up a lava lamp to a build server. It was Alberto Savoia, who'd founded a testing tools company (that did some very interesting things around generative testing that have basically never been noticed). Alberto had noticed that people did not react with any urgency when the build broke. They'd check in broken code and go off to something else, only reacting to the breakage they'd caused when some other programmer pulled the change and had problems.
sudo yum -y update
sudo yum-config-manager --enable epel
sudo yum -y install make automake gcc gcc-c++ libcurl-devel proj-devel geos-devel
cd /tmp
curl -L http://download.osgeo.org/gdal/2.0.0/gdal-2.0.0.tar.gz | tar zxf -
cd gdal-2.0.0/
./configure --prefix=/usr/local --without-python
make -j4
sudo make install
#!/bin/bash | |
# | |
# Script to setup a Elastic Beanstalk AMI with geospatial libraries and postGIS | |
# | |
# sh aws_ami_prep.sh > aws_ami_prep.log 2>&1 & | |
# Go to ec2-user home directory | |
cd /home/ec2-user | |
# yum libraries |
import cx_Oracle | |
def perform_query(query, bind_variables): | |
connection = db_pool.acquire() | |
cursor = connection.cursor() | |
cursor.execute(query, bind_variables) | |
result = cursor.fetchall() | |
cursor.close() | |
db_pool.release(connection) | |
return result |