# will not work in all cases, see https://gist.github.com/angelo-v/e0208a18d455e2e6ea3c40ad637aac53#gistcomment-3439904 | |
function jwt-decode() { | |
sed 's/\./\n/g' <<< $(cut -d. -f1,2 <<< $1) | base64 --decode | jq | |
} | |
JWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ | |
jwt-decode $JWT |
# Get IAM Role name from Instance Profile Id | |
curl http://169.254.169.254/latest/meta-data/iam/info | |
# Get credentials | |
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name> | |
# More info | |
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html | |
import asyncio | |
import socket | |
class UDPClient(): | |
def __init__(self, host, port, loop=None): | |
self._loop = asyncio.get_event_loop() if loop is None else loop | |
self._sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
self._sock.setblocking(False) | |
self._addr = (host, port) |
[Plover][] is an awesome open source stenography program, but to run the software [you need an NKRO keyboard][nkro]. The [ErgoDox keyboard][ergodox] can be made to run in NKRO mode by following these steps.
These instructions are based on this document, which assumes you're using Windows. I'm using a mac, and I had to download and install the [CrossPack for AVR Development][crosspack] before the build process worked.
The NKRO firmware and Plover keymap can be found in the simon_layout
branch of @shayneholmes fork of tmk_keyboard
. Get the source:
Z-Order curves are used to encode multiple dimensions to one dimension while maintaining locality. This feature makes them useful for indexing multidimensional data such as geospatial data. In BigTable-like systems (Accumulo, HBase, Cassandra a z-order curve index can translate a bounding box query to a single range scan. As this example shows, sometimes the locality properties of the curve are very good and few points outside the bounding box are scanned. Other times though, many points outside the bounding box are scanned if using a single range.
This example was inspired by Mike Bostock's Quadtree example
#!/usr/local/bin/macruby | |
framework 'Cocoa' | |
framework 'QuartzCore' | |
framework 'CoreGraphics' # Mountain Lion Update | |
class FireworkDelegate | |
attr_accessor :window | |
def initWithURL(url) | |
case url |
framework 'Cocoa' | |
class NSColor | |
def toCGColor | |
color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace) | |
## approach #1 | |
# components = Array.new(4){Pointer.new(:double)} | |
# color_RGB.getRed(components[0], | |
# green: components[1], | |
# blue: components[2], |
; A REPL-based, annotated Seesaw tutorial | |
; Please visit https://github.com/daveray/seesaw for more info | |
; | |
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
; Seesaw's basic features and philosophy, but only scratches the surface | |
; of what's available. It only assumes knowledge of Clojure. No Swing or | |
; Java experience is needed. | |
; | |
; This material was first presented in a talk at @CraftsmanGuild in | |
; Ann Arbor, MI. |
require 'benchmark' | |
class Proc | |
def slow_callback(callable, *args) | |
self === Class.new do | |
method_name = callable.to_sym | |
define_method(method_name) { |&block| block.nil? ? true : block.call(*args) } | |
define_method("#{method_name}?") { true } | |
def method_missing(method_name, *args, &block) false; end | |
end.new |