Skip to content

Instantly share code, notes, and snippets.

View gist:911aa92dfda6cf1fd2c1d867378a69c0
#!/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 Jun 14, 2013
Simple Google Analytics Measurement Protocol Rails Integration
View ga.rb
# -*- 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 Mar 5, 2012 — forked from thb/bad unaccent
Unaccent method for a Ruby string
View bad unaccent
class String
UNACCENT_HASH = {
'A' => 'ÀÁÂÃÄÅĀĂǍẠẢẤẦẨẪẬẮẰẲẴẶǺĄ',
'a' => 'àáâãäåāăǎạảấầẩẫậắằẳẵặǻą',
'C' => 'ÇĆĈĊČ',
'c' => 'çćĉċč',
'D' => 'ÐĎĐ',
'd' => 'ďđ',
'E' => 'ÈÉÊËĒĔĖĘĚẸẺẼẾỀỂỄỆ',
'e' => 'èéêëēĕėęěẹẻẽếềểễệ',
@panterch
panterch / gist:671193
Created Nov 10, 2010
authorized keys recipe
View gist:671193
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" }
View gist:592552
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
View gist:551479
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 Jul 8, 2010
Sample .gitignore for pol
View gist:467801
# 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
View pdflatex.rb
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 Jan 29, 2009
fluxbox keys
View 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
View gvimrc
" gui settings
set noanti guifont=Monaco:h10
set transparency=0
colorscheme macvim
set background=dark
" no toolbar in guimode
set guioptions-=T
if has("gui_macvim")