Skip to content

Instantly share code, notes, and snippets.

@usure
usure / stackr.rb
Last active Aug 29, 2015
stack lang
View stackr.rb
#!/usr/bin/env ruby
def push(element); $stack << element; end
def pop; $stack.pop end
$stack = []
$dictionary = {
'.' => -> { puts(pop) },
'..' => -> { puts($stack) },
'.,' => -> { pp($dictionary)},
@usure
usure / f.rb
Last active Aug 29, 2015 — forked from deadprogram/forth.rb
Forth interpreter in 64 lines of Ruby
View f.rb
#!/usr/bin/env ruby
require 'pp'
def pop; $stack.pop || raise(StackUnderflow); end
def push(expression); $stack << expression; end
def unary; -> { push(yield pop) }; end
def binary; -> { push(yield pop, pop) }; end
def unary_boolean; -> { push(if yield pop then 1 else 0 end) }; end
def binary_boolean; -> { push(if yield pop, pop then 1 else 0 end) }; end
def functions; -> { push(yield pop, pop)}; end
View gist:212ff787026fae307f2b
use std::io;
use std::io::prelude::*;
fn main() {
let stdin = io::stdin();
for line in stdin.lock().lines() {
println!("{}", line.unwrap());
break;
}
}
View keybase.md

Keybase proof

I hereby claim:

  • I am theshadowfog on github.
  • I am tinsef (https://keybase.io/tinsef) on keybase.
  • I have a public key whose fingerprint is CD9C 0E14 5EB5 69AA 8DC4 05A7 4BD5 F707 EFCC 6E2C

To claim this, I am signing this object:

@usure
usure / stack.lisp
Created Jan 13, 2014
A stack in common lisp.
View stack.lisp
(defparameter *stack*
(list 0))
(defun push-to-stack (&rest args)
"This pushes any number of arguments to the stack."
(dolist (arg args)
(push arg *stack*)
(print "ok")))
(defun pop-stack (&rest args)
@usure
usure / blog.rb
Last active Dec 31, 2015
it works
View blog.rb
#!/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby
require 'fileutils'
require 'optparse'
require 'redcarpet'
current_time = Time.now
@pdir = "posts"
@output = "/var/www/blog/posts"
@template = "<center>Title:
<br>Date: **#{current_time}**
</center>"
@usure
usure / fib.rb
Created Oct 22, 2013
Fibonacci sequence in ruby
View fib.rb
a = [1,2]
for i in 0..10
a.push(a[-1] + a[-2])
end
puts a
@usure
usure / index.haml
Created Apr 5, 2013
A CodePen by Greg. REEDR
View index.haml
!!! 5
%title = "APP"
<link href='http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
#header
APP
#menu
<br>
%a{:href => "/"} HOME
|
@usure
usure / 4dl
Last active Oct 12, 2015
4chan thread archiver (UPDATED)
View 4dl
#!/bin/bash
[[ $1 =~ .*org* ]] && \
#thread=`echo $1 | cut -c25-`
thread=`echo $1 | sed "s/4chan.org//g" | sed "s/[^0-9]//g;s/^$/-1/;"`
echo $thread
echo "BOARD?"
read board
cd $board
mkdir $thread