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
// Brainfuck, full implimentation, idea by Marc-André Cournoyer. this is turing complete. | |
// the bracket code was made by a friend, zli5t. my implementations were way too complex. or wrong. | |
// compile: gcc 1L.c | |
// example: | |
// ./a.out ++. | |
// expanded: | |
// incriment reg[0] by 1 | |
// incriment reg[0] by 1 | |
// print out reg[0] | |
// outputs: 2 |
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
lim = lambda{|f,h| | |
y=h | |
1.upto(1.0/0) { |p| ##to infinity | |
x=h+(1.0/10)**p ##increase how close x is to h 1.0,0.1,0.001 etc.. | |
fx=f[x] ##get f(x) | |
break if y==fx ##if we start getting the same val, stop | |
y=fx ##store the last val | |
} | |
y ##return where we stopped | |
} |
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 | |
# Version (0.78) | |
# Created by Artem Titoulenko ([email protected]) | |
# clock in application. I'm tired of counting. | |
# C.rb -- Time keeping script. | |
# Call with no params to clock in/out | |
# Params: | |
# ? : are you clocked in? check | |
# log : peek at the work log |
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
# Dragon Curve algorithm | |
# source: http://en.wikipedia.org/wiki/Dragon_curve | |
# Use: ruby dragon_curve.rb [number of iterations] | |
str = "R" | |
ARGV[0].to_i.times do | |
nstr = str.reverse | |
for i in 0..nstr.length |
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
array = ['test', 'of', 'file']; | |
array2 = ['another', 'array']; | |
// just calls the callback and passes in this item | |
String.prototype.toArray = function(callback) { | |
callback(null, this); | |
}; | |
// test |
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 | |
# coding: utf-8 | |
#this is a normal todo prog which saves your todos in a local file called .todo | |
#./todo --help | |
#todo.rb usage: | |
# todo.rb list all active tasks | |
# todo.rb <task> create a task described by <task> | |
# todo.rb -r <string> deletes all tasks matching <string> |
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 'zmq' | |
class Logger | |
def initialize | |
@context = ZMQ::Context.new | |
@pub = @context.socket ZMQ::PUB | |
@pub.bind "ipc://logger:general" | |
end | |
def log(message) |
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
['open-uri', 'hpricot'].each(&method(:require)) | |
eval("Dir.mkdir %{s}; Dir.chdir %{s}" % {s:"\"electro-house\""}) | |
(open("http://console.fm/electro-house") { |html| Hpricot(html) }).search("a[@href*=media.console.fm/tracks]").each do |a| | |
File.new("#{a.inner_html.gsub!(/[\s&\/',]/, "_")}.mp3", "w").puts(open(a.get_attribute('href')).read); puts "#{a.inner_html}" | |
end |
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
['open-uri', 'hpricot', 'meta-spotify'].each(&method(:require)) | |
playlist = [] | |
(open("http://console.fm/electro-house") { |html| Hpricot(html) }).search("a[@href*=media.console.fm/tracks]").each do |a| | |
m = a.inner_html.match(/(.*?) by (.*?)$/) | |
song = MetaSpotify::Track.search(m[1])[:tracks].first | |
unless song == nil | |
puts "\e[32m#{song.name} by #{song.artists.first.name}\e[0m, #{song.uri} " | |
playlist << song.uri | |
else | |
puts "\e[31mX\e[0m \"#{a.inner_html}\"" |
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 'open-uri' | |
require 'hpricot' | |
class ID3Tag | |
attr_accessor :title, :artist, :album, :year, :comment, :genre, :track | |
def initialize | |
@title = @artist = @album = @comment = "\0" * 30 | |
@year = "\0\0\0\0" |
OlderNewer