Skip to content

Instantly share code, notes, and snippets.

View richardjortega's full-sized avatar

Richard Ortega richardjortega

View GitHub Profile
@richardjortega
richardjortega / Vagrantfile
Last active August 29, 2015 14:16
Vagrant Debian 8 - Rails 4
## http://www.sitepoint.com/vagrantfile-explained-setting-provisioning-shell/
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
@richardjortega
richardjortega / add_time_code_exercise.rb
Last active August 29, 2015 14:05
Time Code Exercise
class TimeMethods
# [H]H:MM {AM|PM} -> 9:13 AM
def add_time(time, minutes)
validate_minutes(minutes)
parsed_time = parse_time(time)
minutes_added = parsed_time[:minutes] + minutes

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
# Steps from http://www.ireckon.net/2013/03/force-rgb-mode-in-mac-os-x-to-fix-the-picture-quality-of-an-external-monitor
# Steps... (make sure to have laptop lid closed and only one monitor hooked up)
# Step 1) $ ruby patch-edid.rb # This will create a new folder inside of the folder this file is ran in, needs to be moved to Step 2
# Step 2) A new folder will be created in your home directory. Move it into the “/System/Library/Displays/Overrides” folder. If Finder tells you that you are overwriting an existing folder, consider backing it up first.
# Step 3) Restart computer
require 'base64'
@richardjortega
richardjortega / cubox-i4pro-setup.md
Last active August 29, 2015 14:04
CuBox i4-Pro - Debian Wheezy (Serial Only) with Ruby 2.1.2, Rails 4.1.2, Expanded FS,Networking

This tutorial assists users of the CuBox i4-Pro (using Freescale's iMX6 SoC) stand up a stable, serial-only version (no desktop/GUI) of Debian Wheezy with working Networking (Ethernet and WiFi) with Ruby/Rails. Information collected from various forum posts, blog posts, etc. Attribution added where I could remember. Using a Windows 8.1 machine, please provide comments for update regarding Mac/Linux tutorial translations (for the most part it shouldn't matter except for how you write ISOs to microSD cards).

Note: Relatively new at this level of Linux usage, if there are better ways to do something please mention in comments so I can update

Download Debian Wheezy ISO image

Note: The password for root is cubox-i on this linked Debian image

  • Download Debian Wheezy (may be updated in future) ISO image from Gunnar Wolf (Debian Developer) at http://people.debian.org/~gwolf/. You can use 7-zip to unpack an XZ file.
  • Alternatively, se
require 'bindata'
class CustomProtocol < BinData::Record
endian :big
stringz :command_word
uint8 :op1
uint8 :op2
end
# Simple, scrappy UDP DNS server in Ruby (with protocol annotations)
# By Peter Cooper
#
# MIT license
#
# * Not advised to use in your production environment! ;-)
# * Requires Ruby 1.9
# * Supports A and CNAME records
# * See http://www.ietf.org/rfc/rfc1035.txt for protocol guidance
# * All records get the same TTL
@richardjortega
richardjortega / linux_commands.md
Created May 6, 2014 16:59
Linux Commands [Find big ass files, truncate those files]

Switch to logrotate later for better managability.

Find big ass files

$ cd /
# This command will find top 10 files based on disk usage
$ du -hsx * | sort -rh | head -10

Truncate big ass files to Zero

@richardjortega
richardjortega / git_global_config.md
Last active August 29, 2015 13:59
EcoD Notes and Environment Setup

Set your name and email for your commit messages

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

Exclude git tracking UNIX file permissions: Unix file permissions modes (755=rwxrw_rw_, 644=rw_r__r__) - the old mode included the +x (executable) flag, the new mode doesn't. http://code.google.com/p/msysgit/issues/detail?id=164