Skip to content

Instantly share code, notes, and snippets.

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:

use std::io;
use std::io::prelude::*;
fn main() {
let stdin = io::stdin();
for line in stdin.lock().lines() {
println!("{}", line.unwrap());
break;
}
}
@usure
usure / f.rb
Last active August 29, 2015 14:27 — forked from deadprogram/forth.rb
Forth interpreter in 64 lines of Ruby
#!/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
@usure
usure / stackr.rb
Last active August 29, 2015 14:27
stack lang
#!/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 / cTwit.sh
Created October 26, 2011 22:53
cmus twitter bash script
#cmus and ttytter must be installed
#Full twitter intergration coming soon to script. (No need for ttytter)
PROGRAM='cmus'
#DIRECTORY="$HOME/log"
if ps ax | grep -v grep | grep $PROGRAM > /dev/null
then
echo "CMUS is running"
else
echo "cmus is not running! Start cmus and then try again."
exit 1
@usure
usure / irx.sh
Created October 28, 2011 00:42
SystemMonitor BASH
#!/bin/bash
############# SYSTEM MONITOR ######################
#Made by Gregory12z
#UNFINISHED. Only shows minimal info. ALSO... Next version will use ncurses.
#Enjoy.
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
@usure
usure / cTwitx.sh
Created October 30, 2011 19:33
cmusTweeter
#!/bin/bash
#Twitter tweeter by http://360percents.com
#v1.1 on May 12th 2011
#Edited by TheShadowFog
PROGRAM='cmus'
#DIRECTORY="$HOME/log"
username="email"
password="password"
@usure
usure / gist:2312591
Created April 5, 2012 17:14
4chan thread archiver
#!/bin/bash
$tnumbertnumber=`echo $1 | cut -c32-`
mkdir $tnumber
cd $tnumber
while :
do
wget -e robots=off -E -nd -nc -np -r -k -H -D images.4chan.org,thumbs.4chan.org $1
cp $tnumber.html index.html
sleep 10
done
require 'isaac'
require 'lastfm'
api_key = "api_keyhere"
api_secret = "api_secret here"
lastfm = Lastfm.new(api_key, api_secret)
token = lastfm.auth.get_token
#puts api_key
#puts token
puts "http://www.last.fm/api/auth/?api_key=#{api_key}&token=#{token}"
sleep 10.0
@usure
usure / random imgur
Created July 3, 2012 18:00
random imgur
require 'net/http'
require 'uri'
def isLive?(url)
uri = URI.parse(url)
response = nil
Net::HTTP.start(uri.host, uri.port) { |http|
response = http.head(uri.path.size > 0 ? uri.path : "/")
}
return response.code == "200"