Skip to content

Instantly share code, notes, and snippets.

View codekiln's full-sized avatar
🎧
Feedback Loops

λ🏺 codekiln

🎧
Feedback Loops
View GitHub Profile
@codekiln
codekiln / slack_postback_lambda.js
Created September 13, 2017 23:56
AWS Lambda Post To Slack Channel from DynamoDB
var AWS = require('aws-sdk');
var path = require('path');
var https = require('https');
/**
* This assumes that messages are added to DynamoDB
* with parameters `name` and `message`.
*
* To get this to work with your slack channel, you
* first need to configure Incoming Webhook for your
@codekiln
codekiln / tarhash.py
Last active March 14, 2024 23:40
Get the checksum of a tarfile by path
def tarhash(tarpath, hash='sha1'):
"""
given a path to a tar file, return a checksum of its
summed / concatenated contents.
tarpath - a tar.gz path string to open
hash - one of the hash methods supported by hashlib
"""
total_hash = hashlib.new(hash)
with open(tarpath, 'rb') as input_file:
@codekiln
codekiln / get_git_object_hash.py
Created May 2, 2017 18:44
Get Git Object Hash
import os
import hashlib
def get_git_object_hash(filepath):
"""
If you use git hash-object <file>, it will give you git's
internal hash for that object: http://stackoverflow.com/a/552725/78202
This method provides a way to get a git-compatible hash of the file
at path `filepath`.
"""