Skip to content

Instantly share code, notes, and snippets.

<IfDefine PASSENGER>
LoadModule passenger_module modules/mod_passenger.so
PassengerRoot /usr
PassengerLogLevel 0
PassengerRuby /usr/bin/ruby18
RailsAutoDetect On
FileETag None
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
ExpiresActive On
<FilesMatch "\.(ico|gif|jpe?g|png|js|css|htc|swf)(\?\d+)?$">
ExpiresDefault "access plus 1 year"
</FilesMatch>
@thegcat
thegcat / exam.rb
Created July 29, 2011 12:21
Menüs von der stwdo Seite scrapen
%w(open-uri rubygems nokogiri).each{|m| require m}
Nokogiri::HTML(open("http://www.stwdo.de/index.php?id=102")).css('table.SpeiseplanHeute tr').inject({}) {|m,r| m.merge((c=r.css('td').collect(&:content))[0] => c[1])}.delete_if {|k,v| k.nil?}.each {|k,v| puts "#{k}: #{v}"}
@thegcat
thegcat / uberspace-install-grack.sh
Created October 31, 2011 21:34
This installs grack and a fastcgi handler for it on your uberspace.
#!/bin/sh
UBERSPACE_RUBY_1_8_PATH="/package/host/localhost/ruby-1.8.7-p352/bin/ruby"
UBERSPACE_USER_HTTP_HOST="http://`id -un`.`hostname`"
FCGI_SCRIPT_PATH="fcgi-bin/git.fcgi"
FCGI_SCRIPT_FS_PATH="${HOME}/${FCGI_SCRIPT_PATH}"
FCGI_SCRIPT_URL="${UBERSPACE_USER_HTTP_HOST}/${FCGI_SCRIPT_PATH}"
GRACK_PATH="${HOME}/.grack"
#!/usr/bin/env ruby
msb, memsize = 31, nil
puts File.open('mpsoc_top.xdl', 'r').each_line.collect {|line| line.scan(/inst "([^\s\"]+)".*RAMB16_([\w\d]+)/)[0]}.compact.tap {|mems| memsize = mems.count}.collect {|mem0,mem1| " #{mem0} [#{msb}:#{(msb = msb - 32 / memsize) + 1}] PLACED = #{mem1}"}.unshift("ADDRESS_SPACE lmb_bram_#{memsize} RAMB16 [0x00000000:0x0000#{(2048*memsize-1).to_s(16)}]", " BUS_BLOCK").push(" END_BUS_BLOCK;", "END_ADDRESS_SPACE;").join("\n")