Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Drew Blas drewblas

🏠
Working from home
View GitHub Profile
@drewblas
drewblas / validating.md
Last active Mar 30, 2016 — forked from gamache/validating.md
Validating Data in Elixir with ExJsonSchema
View validating.md

priv/schema.json

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Events API Schema",

  "definitions": {

 "event_collection": {
@drewblas
drewblas / encryption_mistake_example.rb
Last active Aug 29, 2015
Encryption Mistake Example
View encryption_mistake_example.rb
require 'openssl'
=begin
Most plaintext must be fed as a string or a binary object to be encrypted.
However, it's often possible to mis-decode the plaintext before encrypting it.
i.e. If it's received as a string in JSON, you often don't know if the string
is an encoded representation (e.g. plain, hex encoded, base64 encoded, etc)
View keybase.md

Keybase proof

I hereby claim:

  • I am drewblas on github.
  • I am drewblas (https://keybase.io/drewblas) on keybase.
  • I have a public key whose fingerprint is 3EDF C403 0683 9E45 F58E 7036 6619 71D9 1784 3713

To claim this, I am signing this object:

View luhn_check.html
<html>
<head>
<script>
function check_cc() {
var r = document.getElementById("results");
var elem = document.getElementById("ccnum");
r.innerHTML = "Checking CC: " + elem.value + "<br>";
@drewblas
drewblas / gist:6977965
Last active Dec 25, 2015 — forked from markmcspadden/gist:6976551
Forking for love
View gist:6977965

Disclaimer: In the coder spirit, I've forked Mark's gist. I do this not to take his words, but rather to echo his sentiments, reinforce his approach, and add my voice to his in a fashion I hope will help keep this discussion alive. I invite others to do the same.

Original:


I'm writing in response to events that have recently come to light involving a sexual assault at a tech conference. Background information can be found [here][1], [here][2], and [here][3] as well as on twitter and google.


@drewblas
drewblas / gist:5390358
Created Apr 15, 2013
Launch an instance with a specific root disk size instead of the default
View gist:5390358
# Launch an instance with a specific root disk size instead of the default
UBUNTU_EBS_IMAGE=ami-d0f89fb9
# New volume size in GB
VOLUME_SIZE=30
SNAPSHOT_ID=`ec2-describe-images $UBUNTU_EBS_IMAGE | egrep "^BLOCKDEVICEMAPPING" | cut -f4`
ec2-run-instances $UBUNTU_EBS_IMAGE \ # Don't forget all your other normal parameters
--block-device-mapping "/dev/sda1=$SNAPSHOT_ID:$VOLUME_SIZE:true:standard"
View ruby_quiz1.rb
# =============================
# Test case showing what we expect to happen
a1 = 'z'
b1 = 'z'
a = [a1]
b = [b1]
a1 == b1 # true
a1.eql? b1 # true
a1.equal? b1 # false different object_ids, as expected
@drewblas
drewblas / README.md
Created Nov 14, 2011 — forked from fnichol/README.md
Chef Bootstrapper For SuSE/SLES
View README.md

Chef Bootstrapper For SuSE/SLES

Installation

Note: Run this script as the root user (no sudo calls are used in the script).

You will need the curl package installed, though I would have no idea why it wouldn't be installed by default:

zypper --non-interactive install curl

View compare-thesiswp.pl
# Copyright 2010 Drew Blas <drew.blas@gmail.com>
# From: http://drewblas.com/2010/07/15/an-analysis-of-gpled-code-in-thesis
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
View thesiswp-similarities.php
// From: http://drewblas.com/2010/07/15/an-analysis-of-gpled-code-in-thesis
// PARTIAL RESULTS of comparison of Wordpress 2.0 & Thesis 1.7
//-- Match from <wordpress/wp-includes/comment-template.php>:1428 to <thesis_17/lib/classes/comments.php>:182 --
$r['per_page'] = get_query_var('comments_per_page');
//-- Match from <wordpress/wp-includes/comment-template.php>:1430 to <thesis_17/lib/classes/comments.php>:183 --
if (empty($r['per_page'])) {
//-- Match from <wordpress/wp-includes/comment.php>:724 to <thesis_17/lib/classes/comments.php>:189 --