This file contains hidden or 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
// Partial response types for E*Trade API | |
// See https://apisb.etrade.com/docs/api/market/api-quote-v1.html | |
// and https://apisb.etrade.com/docs/api/market/api-market-v1.html | |
/* | |
* Quote API | |
*/ | |
export type Message = { | |
description: string; |
This file contains hidden or 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
// original from: http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/ | |
// original gist: https://gist.github.com/willpatera/ee41ae374d3c9839c2d6 | |
function doGet(e){ | |
return handleResponse(e); | |
} | |
// Enter sheet name where data is to be written below | |
var SHEET_NAME = "current"; |
This file contains hidden or 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
CREATE OR REPLACE FUNCTION generate_sequential_uuid(p_interval_length int DEFAULT 60) | |
RETURNS uuid | |
LANGUAGE plpgsql | |
AS $$ | |
DECLARE | |
v_i int; | |
v_time bigint; | |
v_bytes int[16] = '{}'; | |
v_hex text[16] = '{}'; | |
BEGIN |
Template that will create the following:
- API Gateway:
- Deployed as a
REGIONAL
endpoint. - Single root method, accepting
POST
requests only, with Lambda proxy integration to a target function.
- Deployed as a
- In-line Python Lambda function echoing back requesting users IP address to API Gateway requests:
- IAM role for Lambda allowing CloudWatch logs access.
- Permissions for Lambda that allow API Gateway endpoint to successfully invoke function.
This file contains hidden or 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
user web; | |
# One worker process per CPU core. | |
worker_processes 8; | |
# Also set | |
# /etc/security/limits.conf | |
# web soft nofile 65535 | |
# web hard nofile 65535 | |
# /etc/default/nginx |
NGINX does weird things with If statements: http://wiki.nginx.org/IfIsEvil
It turns out, "if" inside a location directive w/ proxy_pass disables that implied URL-rewriting function. So, for example:
location /some/url/ {
proxy_pass http://backend/api/;
# example client url: http://server/some/url/data
# URL sent to proxy: http://backend/api/data
}
This file contains hidden or 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
#!/usr/bin/ruby | |
# Create display override file to force Mac OS X to use RGB mode for Display | |
# see http://embdev.net/topic/284710 | |
require 'base64' | |
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
NewerOlder