(defun fact (n)
(if (= n 1)
1
(* n (fact (1- n)))))
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'json' | |
require 'net/http' | |
require 'colorize' | |
def fetch(url) | |
resp = Net::HTTP.get_response(URI.parse(url)) | |
data = resp.body |
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
#!/usr/bin/env ruby | |
require 'html2markdown'; puts HTMLPage.new(:contents => ARGF.read).markdown |
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
; Swap Registers A & B with no tmp | |
JMP start | |
ARG1: DB 13 ; Variable | |
ARG2: DB 3 ; Variable | |
start: | |
MOV A, [ARG1] ; A = ARG1; | |
MOV B, [ARG2] ; B = ARG2; |
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
; int mod(int a,int b) | |
; by Topher6345 | |
; Implements a integer modulo function | |
; for Simple 8-bit Assembler Simulator | |
; http://schweigi.github.io/assembler-simulator/index.html | |
JMP start | |
ARG1: DB 13 ; Variable |
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
; printf(int) | |
; by Topher6345 | |
; Prints a decimal-formatted, positive 8-bit integer to stdout. | |
; for Simple 8-bit Assembler Simulator | |
; http://schweigi.github.io/assembler-simulator/index.html | |
JMP start | |
hello: DB 78 ; int *hello; The number we wish to print; |
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 'nokogiri' | |
require 'open-uri' | |
site = 'http://reddit.com/r/showerthoughts/.xml' | |
doc = Nokogiri::HTML(open(site)) | |
filenames = [] | |
doc.css("title")[3].children.text.gsub(/"/, "").split(' ').each_with_index do |word, i| |
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
#!/usr/bin/ruby | |
# usage: set_permissions.rb [access_key_id] [secret_access_key] [bucket_name] | |
# ----------------------------------------------------------------------------- | |
# This script provides a means of updating all of the files in an S3 bucket to | |
# have the correct permissions. As this script is effectively throwaway it | |
# doesn't do much beyond making sure it runs at least once, however, is worth | |
# keeping around as a reference in the event the problem arises again. | |
# ----------------------------------------------------------------------------- | |
require 'rubygems' |