Skip to content

Instantly share code, notes, and snippets.

View rudolph9's full-sized avatar

Kurt Robert Rudolph rudolph9

View GitHub Profile
@rudolph9
rudolph9 / multi_user_screen_session.md
Created February 15, 2012 20:13
Creating a multi user GNU screen session

Initial configuration of system:

Make the proper permisions for the screen command

sudo chmod u+s $(which screen)
sudo chmod 755 /var/run/screen/
sudo rm -rf /var/run/screen/*

Screen setup

@rudolph9
rudolph9 / gistGithubAddPaginationToTop4MyGists.user.js
Created April 4, 2012 12:15 — forked from erikvold/gistGithubAddPaginationToTop4MyGists.user.js
This userscript will add the pagination for the gist.github.com My Gists page.
// ==UserScript==
// @name Add Pagination For My Gists To Top
// @namespace gistGithubAddPaginationToTop4MyGists
// @include /^http:\/\/gist\.github\.com\/mine([?#].*)?$/i
// @include http://gist.github.com/mine*
// @match http://gist.github.com/mine*
// @datecreated 2010-03-21
// @lastupdated 2010-03-21
// @version 0.1
// @author Erik Vergobbi Vold
@rudolph9
rudolph9 / gist:2510343
Created April 27, 2012 15:52
stack_question.iterating_over_yard_macro_registers
# see http://stackoverflow.com/questions/10343634/iterating-over-the-registers-of-a-yardoc-macro for original question.
module my_module
class Resource
# @macro dsl_method
# @method $1(${2--2})
# @return [${2}] the return value of $0
def self.property(name, type, args*) end
end
@rudolph9
rudolph9 / method_overloading
Created September 27, 2012 14:45
Ruby Method Overloading Example
[1] pry(main)> puts "hello world!"
hello world!
=> nil
[2] pry(main)> class << self
[2] pry(main)* def puts string
[2] pry(main)* print "overloaded! " + string + "\n"
[2] pry(main)* end
[2] pry(main)* end
=> nil
[3] pry(main)> puts "hello world!"
@rudolph9
rudolph9 / pig_latin.rb
Last active December 14, 2015 17:48
PigLatin
def translate string
string.gsub( /((?:(?:qu))*[^aeiou]*)(\w*)/, '\2\1') + 'ay'
end
def link_to(text, address)
"<a href='#{ address }'>#{ text }</a>"
end
def content_tag tag, &block
"<#{ tag.to_s }>#{ block.call }</#{ tag.to_s}>"
end
@rudolph9
rudolph9 / gist:5751446
Created June 10, 2013 19:22
MicroAeth
>>> microAeth = serial.Serial('/dev/ttyUSB1', 500000, timeout=1, parity=serial.PARITY_MARK)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/serial/serialutil.py", line 261, in __init__
self.open()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 282, in open
self._reconfigurePort()
File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 376, in _reconfigurePort
raise ValueError('Invalid parity: %r' % self._parity)
ValueError: Invalid parity: 'M'
@rudolph9
rudolph9 / gist:5784015
Created June 14, 2013 18:09
reverses a string
#include <stdio.h>
#include <string.h>
int main ()
{
char str0[]="Hello world";
char str1[40];
int str0_length = strlen(str0);
int i;
for( i = 1 ; i <= str0_length ; i++)
com.write_message( ("\x02" + 6.chr + "AE5X:W" + ("AE5X:W" ^ 6.chr) + "\x03").force_encoding("ASCII-8BIT"))
class ::String
###
# @return the first charater in the string as an integer
def byte
self.bytes[0]
end
###

Iterating Iteratively

Given a forward linked list, define an iterator wich traverses each node in the linked list calling next function repeatively?