Skip to content

Instantly share code, notes, and snippets.

View ShakataGaNai's full-sized avatar
🐍
Can Has Status! Working on the Pythons

Jon Davis ShakataGaNai

🐍
Can Has Status! Working on the Pythons
View GitHub Profile
@ShakataGaNai
ShakataGaNai / gist:5566077
Last active December 17, 2015 06:29
function ddbLogSMS() - Sample for DynamoDB/Twilio. For http://snowulf.com/2013/05/13/wrapping-my-brain-around-dynamodb/
function ddbLogSMS($act,$data){
date_default_timezone_set("UTC");
$now = time();
$upd = array();
$upd['ACTION'] = array("Action" => \Aws\DynamoDb\Enum\AttributeAction::PUT,
"Value" => array(
Type::STRING => $act
)
);
/*
* Handy Reference: http://www.sublimetext.com/docs/file-type-preferences
*/
{
"ignored_packages":
[
"Vintage"
],
"indent_guide_options":
[
[
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+shift+r"], "command": "reindent" }
]
var express = require("express");
var app = express();
// http://localhost:9001/users/1
app.get('/users/:id', function(req, res, next){
var id = req.params.id;
if (checkPermission(id)) {
res.send("private");
} else {
@ShakataGaNai
ShakataGaNai / dd-agent.yaml
Created June 25, 2017 19:10
Sample Datadog agent for Kubernetes 1.6+ using Taints and Tolerances
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: dd-agent
spec:
template:
metadata:
labels:
app: dd-agent
name: dd-agent
var AWS = require('aws-sdk');
exports.handler = (event, context, callback) => {
var iotdata = new AWS.IotData({endpoint: 'ASDFASDF.iot.us-west-2.amazonaws.com'});
var params = {
topic: 'esp8266_RANDOMID/hellofromamzn',
payload: 'This is from Lambda',
qos: 0
};
@ShakataGaNai
ShakataGaNai / lambda-at-edge-headers.js
Last active September 19, 2017 22:06
A quick demonstration of using Lamba@Edge to inject extra HTTP Security/Cache Headers
'use strict';
exports.handler = (event, context, callback) => {
const response = event.Records[0].cf.response;
const headers = response.headers;
var hr = {
'Strict-Transport-Security': 'max-age=600;',
'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate',
'Pragma': 'no-cache',
'X-LambdaAtEdge': 'true'

Keybase proof

I hereby claim:

  • I am shakataganai on github.
  • I am shakataganai (https://keybase.io/shakataganai) on keybase.
  • I have a public key ASBD1taS5cFXVX0sc9IOHeYf5LGNCaJPV4U4JoLpBUjz7wo

To claim this, I am signing this object:

@ShakataGaNai
ShakataGaNai / strip-exif.py
Created November 1, 2017 00:36
Load every JPG file in the current directory and strip all the exif from it.
from PIL import Image
import re
from os import listdir
from os.path import isfile, join
def clean(f):
image_file = open(f)
image = Image.open(image_file)
data = list(image.getdata())
@ShakataGaNai
ShakataGaNai / backup.sh
Created November 22, 2017 17:28
Mackup & Keybase powered CLI Backup
#!/bin/bash
DIR="$( cd "$( dirname "$0" )" && pwd )"
mackup backup -f
cd $DIR
git add --all
git commit -m "automated backup `date`"
git push