Skip to content

Instantly share code, notes, and snippets.

View lsolesen's full-sized avatar

Lars Olesen lsolesen

View GitHub Profile
@lsolesen
lsolesen / dupthat.sh
Created November 28, 2012 22:03 — forked from tsileo/duptools.sh
A bash script to simplify backup management with duplicity (encrypted incremental backups via SCP)
#!/bin/bash
# user info
USER=USERNAME
PASSWORD=SECRET
export PASSPHRASE=GPG-PARAPHRASE
# server info
PROTOCOL="scp"
SERVER=SERVERNAME
@lsolesen
lsolesen / boa.rb
Created November 28, 2012 08:34 — forked from jtimberman/boa.rb
remote_file "/tmp/BOA.sh" do
source "http://files.aegir.cc/BOA.sh.txt"
mode 00755
end
execute "/tmp/BOA.sh" do
creates "/usr/local/bin/boa"
end
(1..3).each do |boa_user|
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "base"
# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui
# Forward a port from the guest to the host, which allows for outside
Drush command terminated abnormally due to an unrecoverable error. Error: Class 'RegistrationTypeUIController' not found in /data/disk/o1/static/vih--drupal-7.15-build-20121006-/profiles/vih_dk/modules/contrib/entity/entity.module, line 994
<?php
/**
* Implements hook_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state).
*/
function hook_form_commerce_cart_add_to_cart_form_alter(&$form, &$form_state) {
$options = $form['product_id']['#options'];
$op = array();
foreach ($options as $key => $value) {
$op[] = $key;
}
@lsolesen
lsolesen / .travis.yml
Created August 13, 2012 11:18
Travis CI-integration for a Drupal 7 installation profile
language: php
php:
- 5.3
mysql:
database: drupal
username: root
encoding: utf8
<?php
abstract class BasicUsersMigration extends Migration
{
public function __construct()
{
parent::__construct();
// With migrate_ui enabled, migration pages will indicate people involved in
// the particular migration, with their role and contact info. We default the
// list in the shared class; it can be overridden for specific migrations.
@lsolesen
lsolesen / template.php
Created June 24, 2011 18:58
Change tabs to contextual links in Drupal 7
/**
* Implements hook_menu_local_task()
*
* @param array $variables
*
* return string with html
*/
function mytheme_menu_local_task($variables) {
$link = $variables['element']['#link'];
// remove the view link when viewing the node
@lsolesen
lsolesen / checkshutdown.sh
Created June 19, 2011 07:56
Settings for mediacenter build using mythtv, xbmc and ubuntu 11.04 natty
#!/bin/sh
#
# Checks whether the box can be shutdown
#
IS_XBMC_RUNNING=$(pgrep xbmc)
mythshutdown --check
MYTHSTATUS=$?
if [ $MYTHSTATUS -ne 0 ]; then
@lsolesen
lsolesen / preg_match_yaml_frontmatter.php
Created May 4, 2011 14:27
How do you get the YAML frontmatter of a file?
<?php
$string = '---
layout: default
title: Some title - yeah, right
---
<h1>Tester</h1>
<p>Some content</p>';
preg_match("'/---.*?---/s'", $content, $yaml_frontmatter);