Skip to content

Instantly share code, notes, and snippets.

View twslankard's full-sized avatar

Tom Slankard twslankard

  • Ouster Inc.
  • San Francisco, CA
View GitHub Profile
@twslankard
twslankard / gist:637020
Created October 20, 2010 18:35
Verifying Amazon SNS Notification Signatures
<?php
// get the raw HTTP post data
$postdata = file_get_contents('php://input');
// the post data is JSON, so let's decode it and grab the various fields
$json = json_decode($postdata);
$subject = $json->Subject;
$message = $json->Message;
$signature = $json->Signature;
@twslankard
twslankard / getaddrinfo.c
Created May 31, 2011 20:24
getaddrinfo / inet_ntop example
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <netdb.h>
int main(int argc, char * argv[]) {
struct addrinfo * _addrinfo;
struct addrinfo * _res;
@twslankard
twslankard / mountpoint.c
Created January 14, 2011 22:25
Using stat to determine programmatically whether a file is a mount point.
#include <assert.h>
#include <sys/stat.h>
#include <stdint.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char * argv[]) {