This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'sinatra/namespace' | |
require 'mongoid' | |
ENV["RACK_ENV"] ||= "development" | |
Mongoid.load!("mongoid.yml") | |
class Note | |
include Mongoid::Document | |
field :body, type: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'sequel' | |
# $ gem install thin mysql sequel | |
# the mysql gem is a MASSIVE pain in the ass, would rather | |
# use something saner like Postgres or Mongo or Redis | |
# thin is required, WEBRick is terrible | |
set :server, :thin | |
get '/' do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'pty' | |
get '/' do | |
"<form action='/' method='POST'><input type='text' name='command'><input type='submit' value='run'></form>" | |
end | |
post '/' do | |
stream do |out| | |
out << "<html><body><pre>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.globl _max | |
_max: | |
pushl %ebp | |
movl %esp, %ebp | |
movl 8(%ebp), %ecx #; assume first number is the greatest | |
movl %ecx, %eax #; eax points to the beggining of numbers[] | |
movl (%ecx), %ecx #; %ecx stores the highest number found | |
movl 12(%ebp), %edx #; len |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.globl max | |
max: | |
pushl %ebp | |
movl %esp, %ebp | |
mrmovl 8(%esp), %ecx | |
rrmovl %ecx, %eax #; pointer to numbers[] | |
mrmovl (%ecx), %ecx #; ecx holds greatest encountered | |
#; number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
.globl | |
getCharAsInt: | |
pushl %ebp | |
movl %esp, %ebp | |
movl 8(%ebp), %eax | |
movl 12(%ebp), %edx | |
addl %edx, %eax | |
movb (%eax), %al | |
movsbl %al, %eax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# registers | |
$reg = {eax: 0, ebx: 0, ecx: 0, edx: 0, esi:0, edi: 0, esp: 0, ebp: 0} | |
$Stack = [] | |
$verbose = false | |
def gr(term); $reg[term]; end | |
def valid_reg(term); !$reg[term[1..-1].to_sym].nil?; end | |
def valid_imm(term); term[1..-1].to_i && term != "$0" ? true : false; end | |
def eval_asm(line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void addTag(String word, String tag) { | |
recursiveAddTag(root, word, tag); | |
} | |
private void recursiveAddTag(TagNode parent, String word, String tag) { | |
for (TagNode ptr=parent; ptr != null;ptr=ptr.sibling) { | |
String[] parts = ptr.tag.split(word+"[^\\s\\w]*",2); | |
if(parts.length > 1) { | |
System.out.println("operating on: " + java.util.Arrays.toString(parts)); | |
if(ptr.tag.equals(word)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
01: level1 | |
02: WE5aVWRwYPhX | |
03: 1MkIE7hhtlXA | |
04: 1ZwMe9q1nDC9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bar | |
import ( "fmt" ) | |
// should be in a folder called foo | |
func Bar() { | |
fmt.Println("bats"); | |
} |