Skip to content

Instantly share code, notes, and snippets.

@luxflux
luxflux / Gemfile
Last active December 11, 2015 08:29
Javascript tests with RSpec, Capybara and PhantomJS. An example.
group :test do
gem 'capybara'
gem 'poltergeist'
end
@luxflux
luxflux / listener.coffee
Last active December 11, 2015 18:39 — forked from insom/listener.coffee
# Description:
# "Accepts POST data and broadcasts it"
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
context 'role: user' do
let(:user1) { FactoryGirl.create(:user) }
let(:user2) { FactoryGirl.create(:user) }
let(:admin_user) { FactoryGirl.create(:admin) }
shared_example :ok do
it 'allows access' do
expect { visit path }.to_not raise_error(CanCan::AccessDenied)
end
<html><body>test</body><html>
@luxflux
luxflux / .vimrc
Last active January 2, 2017 00:01
Extract issue id from branch name
" get reference for the current issue from git branch name
" assumes your branch name looks like 1337-fixing-a-lot-of-stuff
"
function GitBranchIssue(fixes)
let current_branch = system("git rev-parse --abbrev-ref HEAD")
let ref = substitute(current_branch, '^.\+\/\(\d\+\).\+$', '\1', '')
if a:fixes == 'true'
let prefix = 'fixes'
else
let prefix = 'refs'
class Daemon
def handle_payload(payload)
event_handler = EventHandler.new(payload[:id], payload)
event_handler.send(payload[:event])
end
end

Keybase proof

I hereby claim:

  • I am luxflux on github.
  • I am r00t (https://keybase.io/r00t) on keybase.
  • I have a public key whose fingerprint is 31C8 212C 6B40 776B 07DF EC36 2716 B66C 93EB 0ECD

To claim this, I am signing this object:

Managing a few servers with Puppet

In this blog post I'm going to show you how I manage a few servers centrally using [Puppet][puppet] without a Puppet Master.

Puppet is an open source configuration management software. It allows you to manage many thousand servers centrally and install packages on them for example. Check out [their website][puppet] for more information. There are also other tools similar to Puppet, like [Chef][chef] or [Ansible][ansible].

The Problem

I run a few virtual servers for personal use (e.g. for backup, file syncing, and some web-based tools). Managing them by hand can be tedious.

@luxflux
luxflux / .sVimrc
Last active August 29, 2015 14:10
map j scrollDown
map k scrollUp
map h scrollLeft
map l scrollRight
node default {
yumrepo { "epel": enabled => 1 }
Package { require => Yumrepo['epel'] }
openvpn::server { 'winterthur':
country => 'CH',
province => 'ZH',
city => 'Winterthur',
organization => 'example.org',
email => 'root@example.org',