Skip to content

Instantly share code, notes, and snippets.

@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"
@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 / 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