Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View digidigo's full-sized avatar

Dave Clements digidigo

  • www.spryelephant.com
  • Boulder, CO
  • X @digidigo
View GitHub Profile
@digidigo
digidigo / mockserver.py
Created December 16, 2023 03:18
mockserver to validate and response to VIO webhooks
from flask import Flask, request, jsonify
import hashlib
import hmac
import json
app = Flask(__name__)
def verify_signature(payload_body, secret_token, signature_header):
hash_object = hmac.new(secret_token.encode('utf-8'), msg=payload_body, digestmod=hashlib.sha256)
expected_signature = "sha256=" + hash_object.hexdigest()
#!/bin/bash
# Check if a URL is provided as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <URL>"
exit 1
fi
# Set the URL from the argument
url="$1"

Keybase proof

I hereby claim:

  • I am digidigo on github.
  • I am digidigo (https://keybase.io/digidigo) on keybase.
  • I have a public key ASCVvp1aQPO7JCUjuFzgZYP3-LeB1RRR8udK6AKe3QHdbwo

To claim this, I am signing this object:

// I couldn't find a github integration for slack or IFTTT that supported
// GitHub releases. And I really didn't want to maintain a server or heroku.
// Enter Parse --- I can think of lots of other use cases for something like this.
Parse.Cloud.define("release_to_slack", function(request, response) {
var release = request.params.release;
var author = release.author.login;
var name = release.name;
var tag_name = release.tag_name;
@digidigo
digidigo / gist:5208934
Created March 20, 2013 22:02
My very first program ever was on a PET computer and was written in basic. Here it is in ruby. What was yours?
while(1)
puts " /\\"
puts " / \\"
5.times do
puts " | |"
end
puts " __"
puts " / \\ "
puts " **"
puts " **"
@digidigo
digidigo / gist:1483411
Created December 15, 2011 23:11
True Twitter Friends
# get union of friends and followers
def true_twitter_friends
return [] unless self.twitter_token && twitter_token.length > 3
return @twitter_friends_cache if @twitter_friends_cache
ids = []
if( !self.twitter_token.blank? )
friends = []
@digidigo
digidigo / WebImageView.java
Created January 28, 2011 22:18
Android ImageView loaded from the Web
import java.io.InputStream;
import java.net.URL;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.util.AttributeSet;
import android.widget.ImageView;
@digidigo
digidigo / UITextField+ColoredPlaceholder.h
Created January 12, 2011 17:41
Category to allow customization of the placeholder in an UITextField
#import <Foundation/Foundation.h>
@interface UITextField (ColoredPlaceholder)
@end
NSString *urlString = @"http://yourserver.com/upload_huge_file";
NSString *filename = @"filename";
NSString * pathToHugeFileToPost = @"hugeFile";
NSMutableURLRequest * request= [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
NSString *boundary = @"---------------------------14737809831466499882746641449";
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary];