Skip to content

Instantly share code, notes, and snippets.

Niklas H niklas

Block or report user

Report or block niklas

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
View cap fooshop -T --trace
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke setup:check_app (first_time)
** Execute setup:check_app
cap aborted!
Don't know how to build task 'deploy:web:enable'
/home/niklas/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task_manager.rb:62:in `[]'
/home/niklas/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rake/task.rb:353:in `[]'
/home/niklas/.rvm/gems/ruby-2.2.3@heute_kaufen/gems/capistrano-3.4.0/lib/capistrano/dsl/task_enhancements.rb:12:in `after'
/home/niklas/work/xunde/b2c/lib/capistrano/tasks/backup.rake:22:in `<top (required)>'
View ubuntu-xsane-server.sh
#!/bin/bash
set -e
sudo aptitude install vim git-core xsane byobu libsane-extras virtualbox-guest-utils ssh
SCANSDIR="$HOME/Scanned"
mkdir -p $SCANSDIR
sudo sed -i "s&exit 0&mount.vboxsf Scanned $SCANSDIR vboxsf\nexit 0&" /etc/rc.local
echo "/etc/rc.local"
tail -n 5 /etc/rc.local
@niklas
niklas / views_for_every_user.rb
Last active Sep 9, 2015
A View for every User
View views_for_every_user.rb
class CompleteCapture < ActiveRecord::Base
TablesName = /\Acomplete_capture(\d+)s\z/
SubClassName = /\ACompleteCapture(\d+)\z/
self.abstract_class = true
cattr_accessor :company
include CapturedAt
class << self
@niklas
niklas / autotop.rb
Created Jul 14, 2014
Setup correct resolutions based on connected displays
View autotop.rb
#!/usr/bin/ruby
def dpi
147
end
def desktop
system "xrandr --output VGA1 --auto --left-of LVDS1 --output LVDS1 --auto --primary --dpi #{dpi}"
system "xset dpms force on" # wake up monitor from power saving mode
system "marble-mouse left"
@niklas
niklas / puppet.conf
Last active Aug 29, 2015
maybe broken puppet.conf
View puppet.conf
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter:/home/guy/puppet/modules/rvm/lib/facter
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post
pluginsync=true
server=hurlg.lanpartei.de
@niklas
niklas / Backup.rb
Created May 19, 2014
Backup script using git
View Backup.rb
#!/usr/bin/env ruby
medium = ARGV.shift || 'Spinn'
user = ENV['USER']
hostname = `hostname`.chomp
path = "/media/#{user}/#{medium}"
rc = "#{ENV['HOME']}/.bashrc-backup"
unless File.directory?(path)
@niklas
niklas / compass-css-sprites-alternatives.txt
Last active Aug 29, 2015
compass CSS-Sprites alternatives
View compass-css-sprites-alternatives.txt
CSS-Sprites alternatives
https://github.com/flyerhzm/css_sprite
* minimagick!
* dirty code
* hard to customize until refactored
https://github.com/railsjedi/sprite
@niklas
niklas / ramir.rb
Created Oct 18, 2013
script to generate symlinks to a ramdisk (good for logs) TODO: * repair symlink targets after reboot * run automatically after chdir
View ramir.rb
#!/usr/bin/env ruby
require 'pathname'
# global setup
ramdisk = Pathname.new( Dir.home(ENV['USER']) ).join('tmp')
if File.read('/etc/mtab').lines.grep(%r~ #{ramdisk} ~).empty?
system "mount", ramdisk.to_s
end
@niklas
niklas / branch_database.sh
Last active Jul 3, 2017
An own database for every branch - escape the migration hell
View branch_database.sh
#!/bin/bash
# An own database for every branch
#
# 1) put this script somewhere, make it executable (chmod +x)
# 2) modify your database.yml:
# development:
# adapter: postgresql
# database: "<%= `path/to/stored_script development` %>"
# You can specify another environment as first arg.
View markup_snapshot.rb
#!/usr/bin/env ruby-1.9.3-p392@markup_snapshot
# Our pixel hero wants to know when we change the HTML layout. This script runs
# selected cucumber features in given branch/sha1 and makes snapshots in HTML
# and HAML, original and stripped.
#
# Prerequisites:
# you
# * have rails project
# * use cucumber with capybara
You can’t perform that action at this time.