Skip to content

Instantly share code, notes, and snippets.

@usure
usure / stack.lisp
Created January 13, 2014 04:18
A stack in common 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 December 31, 2015 00:09
it works
#!/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 October 22, 2013 13:12
Fibonacci sequence in ruby
a = [1,2]
for i in 0..10
a.push(a[-1] + a[-2])
end
puts a
@usure
usure / index.haml
Created April 5, 2013 23:57
A CodePen by Greg. REEDR
!!! 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 October 12, 2015 10:27
4chan thread archiver (UPDATED)
#!/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
@usure
usure / test
Created July 18, 2012 23:57
test
test
@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"
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 / 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
@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"