Skip to content

Instantly share code, notes, and snippets.

View ianAndrewClark's full-sized avatar

Ian Clark ianAndrewClark

View GitHub Profile
@semperos
semperos / deps.edn
Last active September 5, 2019 19:32
Clojure deps.edn Workflow
{:aliases {:dev {:extra-deps
{org.clojure/tools.nrepl {:mvn/version "0.2.13"}
cider/cider-nrepl {:mvn/version "0.17.0-SNAPSHOT"}}}
:std {:extra-paths ["resources"]}
:test {:extra-paths ["test"]}}
:mvn/repos {"private-repo" {:url "https://example.com/repository/maven-releases/"}}}
@stevenringo
stevenringo / deploy_stack.sh
Created September 11, 2017 00:13
Create/update/delete cloudformation stacks with events tailing
set -o pipefail
_exit_error() {
message=$1
code=$2
echo "$message" >&2
exit $code
}
_exit_ok() {
@agouriou
agouriou / nginx.conf
Last active April 5, 2024 15:57 — forked from Stanback/nginx.conf
Example Nginx (> 1.9) configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs. Handle error status (4xx, 5xx) and expose headers.
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers
@ioscott
ioscott / LightningCrawler.md
Last active March 30, 2016 12:17
Lightning Batch Processor examples.

The following are created using Ian's ID so that the Extractor he trained can be used.

If not logged in, run the following from the command line.

curl -c da-user-cookies.txt -XPOST -d "username=your-name&password=your-password" "https://api.staging-owl.com/auth/login"

The Extractor is only able to keep track of one run at a time. If multiple people are following these instructions then they will interfere with each other, it is not a bug. The UI will prevent this however curl doesn't care.

@itsmemattchung
itsmemattchung / Makefile
Last active December 16, 2019 09:30
Makefile example for aws lambda
PROJECT = sample-python-app
FUNCTION = $(PROJECT)
REGION = us-east-1
.phony: clean
clean:
rm -f -r $(FUNCTION)*
rm -f -r site-packages
@dhrrgn
dhrrgn / debug_stuff.py
Last active January 28, 2024 21:25
A handy SQL debug function for Flask-SQLAlchemy
from . import app
from flask.ext.sqlalchemy import get_debug_queries
if app.debug:
app.after_request(sql_debug)
def sql_debug(response):
queries = list(get_debug_queries())
query_str = ''
@dadoonet
dadoonet / backup.sh
Created December 26, 2012 14:50
Backup Elasticsearch node
# Script to be placed in elasticsearch/bin
# Launch it from elasticsearch dir
# bin/backup indexname
# We suppose that data are under elasticsearch/data
# It will create a backup file under elasticsearch/backup
if [ -z "$1" ]; then
INDEX_NAME="dummy"
else
INDEX_NAME=$1
@jasonroelofs
jasonroelofs / Timings.txt
Created November 29, 2012 18:23
Using Go for embarrassingly parallel scripts
] wc -l domains.txt
783 domains.txt
] time go run domain_lookup_parallel.go
real 0m5.743s
user 0m0.359s
sys 0m0.355s
] time go run domain_lookup_sequential.go
@radu-gheorghe
radu-gheorghe / copy_es_index.bash
Created November 5, 2012 09:30
copy one Elasticesarch index to another
#!/bin/bash
CURRENTINDEX="test"
NEWINDEX="newindex"
#where the indices are stored within the DATADIR
INDICESDIR=/var/lib/elasticsearch/elasticsearch/nodes/0/indices/
#get the metadata for the current index
curl localhost:9200/$CURRENTINDEX/_settings?pretty=true > /tmp/settings
curl localhost:9200/$CURRENTINDEX/_mapping?pretty=true > /tmp/mappings
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active June 28, 2024 08:56
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'