Skip to content

Instantly share code, notes, and snippets.

Matt Borja rdev5

Block or report user

Report or block rdev5

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rdev5
rdev5 / sidekiq.confg
Created May 6, 2013
Simple upstart script for sidekiq (used with Gitlab on CentOS 6)
View sidekiq.confg
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
PHP ActiveRecord ORM library loader for CodeIgniter 2.1.3
View ActiveRecord.php
<?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 Dec 17, 2015
Need a simple and effective way to add view partials to your CodeIgniter or PHP application? Try this!
View MY_Controller.php
<?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 / CryptDemo.java
Last active Dec 28, 2015
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 …
View CryptDemo.java
/*
* 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
View gameapi-client.html
<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;
}
View rsync-backup.js
#!/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 = {
View mysql2sqlite.sh
#!/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
View CapacitanceMeter.ino
// 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()
@rdev5
rdev5 / .slate
Last active Aug 29, 2015
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).
View .slate
# 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 Aug 29, 2015
A utility class for establishing SSL connection with remote web service and returning response in SecureString object. Unit tests included.
View SecureClient.cs
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;
You can’t perform that action at this time.