Skip to content

Instantly share code, notes, and snippets.

View panterch's full-sized avatar

Beat Seeliger panterch

View GitHub Profile
@panterch
panterch / ActionMailer Test.rb
Created December 22, 2008 11:39
actionmailer testmail
class Notifier < ActionMailer::Base
def test(recipient)
recipients recipient
from 'notifier@example.com'
subject 'test mail'
body 'test'
end
end
Notifier.deliver_test('x@example.com')
@panterch
panterch / gist:911aa92dfda6cf1fd2c1d867378a69c0
Created February 8, 2021 10:01
Heroku offsite Backup Skript
#!/bin/bash
current_time=$(date "+%Y.%m.%d-%H.%M")
for n in $(heroku apps | grep prod | cut -d ' ' -f 1)
do
echo "backing up: $n"
heroku pg:backups:download --app $n -o /backup/heroku/$n.dump
done
echo "Finished"
# Rotation durch logrotate
@panterch
panterch / ga.rb
Created June 14, 2013 19:57
Simple Google Analytics Measurement Protocol Rails Integration
# -*- encoding : utf-8 -*-
require 'net/http'
class Ga
attr_accessor :user, :category, :action
# target for trackings in test environment
TRACKINGS = []
@panterch
panterch / bad unaccent
Created March 5, 2012 17:59 — forked from thb/bad unaccent
Unaccent method for a Ruby string
class String
UNACCENT_HASH = {
'A' => 'ÀÁÂÃÄÅĀĂǍẠẢẤẦẨẪẬẮẰẲẴẶǺĄ',
'a' => 'àáâãäåāăǎạảấầẩẫậắằẳẵặǻą',
'C' => 'ÇĆĈĊČ',
'c' => 'çćĉċč',
'D' => 'ÐĎĐ',
'd' => 'ďđ',
'E' => 'ÈÉÊËĒĔĖĘĚẸẺẼẾỀỂỄỆ',
'e' => 'èéêëēĕėęěẹẻẽếềểễệ',
@panterch
panterch / gist:671193
Created November 10, 2010 17:41
authorized keys recipe
class authorized_keys {
# install the given keys in the users authorized_keys file
# user name is given as title, keys are names of template files located in
# the modules templates directory
#
# key names are expanded to $keydir/<name>.pub. This ensures minimal writing
# and maintains compatibility with other tools like gitosis.
define install( keys = [ "seb" ], keydir = "/etc/puppet/files/ssh_keys" ) {
$home = $title ? { "root" => "/root", default => "/home/$title" }
require 'tempfile'
tmp = Tempfile.new('poor_mans_profiler')
ObjectSpace.each_object {|obj| tmp << obj.to_s+"\n" if obj.is_a?(String) }
tmp.flush
%pre=tmp.path
node "works" {
include rails # where 'rails' can be an empty class...
file { "/etc/apache2/sites-available/railsapp":
ensure => present,
source => "puppet:///modules/rails/apache",
}
}
@panterch
panterch / gist:467801
Created July 8, 2010 09:31
Sample .gitignore for pol
# git-ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
*~
\#*\#
config/database.yml
coverage/
db/*.sqlite3.db
require 'erb'
require 'tempfile'
class Pdflatex
TEMPLATE_DIR = File.join(RAILS_ROOT, 'app', 'views', 'tex')
def self.run(template_path, locals = nil)
template = File.new(template_path).read
erb = ERB.new(template)
@panterch
panterch / keys
Created January 29, 2009 12:23
fluxbox keys
OnDesktop Mouse1 :HideMenus
OnDesktop Mouse2 :WorkspaceMenu
OnDesktop Mouse3 :RootMenu
OnDesktop Mouse4 :NextWorkspace
OnDesktop Mouse5 :PrevWorkspace
Mod1 Tab :NextWindow
Mod1 Shift Tab :PrevWindow
Mod1 F1 :Workspace 1
Mod1 F2 :Workspace 2