Skip to content

Instantly share code, notes, and snippets.

View rdev5's full-sized avatar
💭
Note: This account has been moved to @mattborja

Matt Borja rdev5

💭
Note: This account has been moved to @mattborja
View GitHub Profile
@rdev5
rdev5 / aesNr.c
Created May 19, 2015 18:49
FIPS-197 6.3 Parameterization of Key Length, Block Size, and Round Number - This standard explicitly defines the allowed values for the key length (Nk), block size (Nb), and number of rounds (Nr). However, future reaffirmations of this standard could include changes or additions to the allowed values for those parameters. Therefore, implementers…
/*
* 6.3 Parameterization of Key Length, Block Size, and Round Number
*/
// Number of columns (32-bit words) comprising the State. For this standard, Nb = 4.
void int Nb(int stateLen)
{
return (stateLen * 8) / 32;
}
@rdev5
rdev5 / SecureClient.cs
Last active August 29, 2015 14:19
A utility class for establishing SSL connection with remote web service and returning response in SecureString object. Unit tests included.
using System;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Net.Security;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
@rdev5
rdev5 / .slate
Last active August 29, 2015 13:55
Supports full screen, left half, right half, and quarter sections for dual monitors (left half of left screen, right half of left screen, left half of right screen, right half of right screen).
# Configs
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config keyboardLayout dvorak
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
// See http://arduino.cc/en/Tutorial/CapacitanceMeter
#include <ShiftLCD.h>
#include <stdlib.h>
ShiftLCD lcd(4, 2, 3);
const int DISCHARGE_PIN = 5;
const int CHARGE_PIN = 6;
const int R_VALUE = 100;
void setup()
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
#!/usr/bin/env node
var sys = require('sys');
var exec = require('child_process').exec;
const RSYNC = '/usr/bin/rsync';
const SSH = '/usr/bin/ssh';
const BANDWIDTH_LIMIT = 512; // Kbps
// Backup destinations
var stores = {
<html>
<head>
<script src="//code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script>
function authenticated() {
var ajax_setup = $.ajaxSetup();
return ajax_setup.headers !== undefined && ajax_setup.headers.Authorization !== undefined && ajax_setup.headers.Authorization !== null;
}
@rdev5
rdev5 / CryptDemo.java
Last active December 28, 2015 22:19
Patch for EncryptedMapDecorator.java (cas-server-extension-clearpass). Returns IV (16 bytes) prepended to ciphertext on encrypt(); mandatory for proper decryption. Useful in clustered environments where IVs saved to thread-safe ConcurrentHashMaps are being stored locally in memory, thus rendering other systems in the cluster unable to decrypt a …
/*
* Licensed to Yavapai College under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
@rdev5
rdev5 / MY_Controller.php
Last active December 17, 2015 23:09
Need a simple and effective way to add view partials to your CodeIgniter or PHP application? Try this!
<?php
class MY_Controller extends CI_Controller {
public function _output() {
/*
$use_default_view = FALSE;
if ($this->content_view !== FALSE && empty($this->content_view)) {
$this->content_view = $this->router->class . '/' . $this->router->method;
$use_default_view = TRUE;
}
@rdev5
rdev5 / ActiveRecord.php
Created May 23, 2013 15:55
PHP ActiveRecord ORM library loader for CodeIgniter 2.1.3
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
function initialize_php_activerecord() {
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300)
die('PHP ActiveRecord requires PHP 5.3 or higher');
define('PHP_ACTIVERECORD_VERSION_ID','1.0');
// This constant allows you to prepend your file to the autoload stack rather than append it.
if (!defined('PHP_ACTIVERECORD_AUTOLOAD_PREPEND')) {