Skip to content

Instantly share code, notes, and snippets.

View justinwsmith's full-sized avatar

Justin W. Smith justinwsmith

  • Amazon Web Services
  • Herndon, VA
View GitHub Profile
@justinwsmith
justinwsmith / quicksort.rs
Created December 29, 2017 14:12
Quicksort implementation in Rust
extern crate time;
extern crate core;
extern crate rand;
use core::fmt::Display;
use rand::Rng;
const SORT_THRESHOLD: usize = 16;
const LIST_SIZE: usize = 10000000;
@justinwsmith
justinwsmith / p3-radius.py
Last active November 24, 2017 10:56
Python3 class for RADIUS authentication
# Python3 class for RADIUS authentication
# Based loosely on code found at: http://github.com/btimby/py-radius/
# Copyright (c) 2015, Justin W. Smith <justin.w.smith@gmail.com>
# Copyright (c) 1999, Stuart Bishop <zen@shangri-la.dropbear.id.au>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
@justinwsmith
justinwsmith / heartbleed.rb
Last active August 29, 2015 13:58
A Ruby exploit of the heartbleed OpenSSL vulnerability
# Copyright (c) 2014 Justin W. Smith
# Don't be evil!
require 'base64'
require 'socket'
require 'optparse'
options = {port: 443}
optparser = OptionParser.new do |opts|
@justinwsmith
justinwsmith / integer-sqrt.rb
Last active January 1, 2016 02:19
An implementation of Integer square root (needed when working with very large numbers).
# Copyright (c) 2014 Justin W. Smith <justin.w.smith@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
@justinwsmith
justinwsmith / string-crypt.rb
Last active January 1, 2016 02:19
This script extends the functionality of the String#crypt method to non-Linux environments. * I'm not the first to implement this. See also: https://github.com/SJD/unix-crypt* The author utilized the documentation provided at this URL: http://www.akkadia.org/drepper/SHA-crypt.txt
#!/usr/bin/ruby
################################
# Copyright (c) 2014 Justin W. Smith <justin.w.smith@gmail.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# Copyright 2012-2013 Barry Allard <barry.allard@gmail.com>
# Copyright 2014 Justin W. Smith <justin.w.smith@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#