Skip to content

Instantly share code, notes, and snippets.

Stefan Wienert zealot128

Block or report user

Report or block zealot128

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zealot128
zealot128 / README.md
Created Oct 18, 2011
pludoni Capistrano Deploy script
View README.md

USAGE

cap deploy:setup
# will create shared dir's and symlinks for assets
#  db, log and "public/system"
cap deploy
# Let's go
@zealot128
zealot128 / install.sh
Created Nov 5, 2011
ubuntu apt install eee-pc
View install.sh
sudo su
apt-add-repository ppa:chromium-daily/ppa
apt-add-repository ppa:eee-control/eee-control
apt-add-repository ppa:ubuntu-mozilla-daily/ppa
apt-get update && sudo apt-get install build-essential eee-control vlc cpufrequtils \
powertop htop install libncurses-dev libgnome2-dev libgtk2.0-dev libatk1.0-dev \
libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev git-core guake \
openssh-server chromium-browser thunderbird thunderbird-locale-de \
exuberant-ctags ack-grep python-pygments
@zealot128
zealot128 / README.md
Created Dec 16, 2011
Ruby - HTML Tagcloud with easy changeable formular
View README.md

Tagcloud Calculation

Usage

Calculate weight of given array. e.g. %w[ruby ruby ruby rails]

Tagcloud.tagcloudize [ "rails", "ruby", "rails" ...] do |count,max|
@zealot128
zealot128 / README.md
Created Dec 16, 2011
Easy XML Sitemap with rails (little work involved anyway)
View README.md

Sitemap XML with Rails

Rails is too custom, to provide a generic sitemap as a gem for any situation. But it ist not too hard anyway! Here is a frame how to make one:

rails g controller sitemap
@zealot128
zealot128 / drush.sh
Created Mar 12, 2012
Drupal 7 Installation with compass configuration
View drush.sh
# Download latest Drupal
version="7.12"
wget http://ftp.drupal.org/files/projects/drupal-$version.tar.gz
tar xf drupal-$version.tar.gz
mv drupal-$version/.* . -f
mv drupal-$version/* .
rm drupal-$version.tar.gz -rf drupal-$version
rm *txt -f
wget http://ftp.drupal.org/files/translations/7.x/drupal/drupal-7.11.de.po -O profiles/standard/translations/drupal-7.11.de.po
chown www-data\: sites/default/ -R
@zealot128
zealot128 / imap-stats.rb
Created May 20, 2012
Imap mail statistic with Ruby
View imap-stats.rb
require "net/imap"
require "progressbar"
require "active_support/all" # sort_by!
class Array
def histogram ; self.sort.inject({}){|a,x|a[x]=a[x].to_i+1;a} ; end
end
server = "mailserver.com"
username = "mail@mailserver.com"
@zealot128
zealot128 / podcast-download.sh
Created Jul 18, 2012
Download Media Podcasts (RSS-Feed with audio/Video in enclosure)
View podcast-download.sh
#!/bin/bash
# Run with podcast-download.sh http://linktofeed.xml
# should work in BusyBox (my NAS is an ARM Linux with busybox)
set -e # exit when one line has error
filename="/tmp/rssdwn-$(date +%s)"
curl $1 2> /dev/null | grep enclosure | sed "s/.*\(http[^\"\?]*\).*/\1/" > $filename
echo "Found $(wc -l $filename) Links, start downloading to pwd"
@zealot128
zealot128 / download_file.rb
Created Jul 22, 2012
Download an URL with open-uri to paperclip
View download_file.rb
# encoding: utf-8
def download_url(url)
url.gsub!(" ","%20")
# TODO better escaping of stuff like umlauts
# url.gsub!("ö","%C3%B6")
logo_path = url.split("/").last
io = open(url)
io.define_singleton_method(:original_filename) do
logo_path
@zealot128
zealot128 / README.md
Created Aug 13, 2012
Debian startup file for Rails thin instances
View README.md

Rails startup with bundler, rvm and specific user

e.g. for user stefan, starting two different applications, located under /apps/APPLICATION/prod/current.

This script is very useful, because it is run at startup of server, so no 503 anymore.

Put this script under /etc/init.d/ and make it executable chmod +x /etc/init.d/rails_apps

@zealot128
zealot128 / config.rb
Created Nov 28, 2012
Earthquake - Show replies to a tweet
View config.rb
# paste into ~/.earthquake/config
Earthquake.init do
command :replies do |m|
thread = [twitter.status(m[1])]
r = twitter.get "/related_results/show/#{273873995647045633}.json"
results = r.first["results"].map{|i|i["value"]}
results.reverse_each.with_index do |t,i|
t["_mark"] = config[:thread_indent] * i
You can’t perform that action at this time.