Skip to content

Instantly share code, notes, and snippets.

user c["username"] do
comment c["username"]
system true
shell "/usr/bin/git-shell"
home "/srv/datas/#{c['username']}"
manage_home true
action :create
end
c_home = File.expand_path("/srv/data/#{c['username']}")
#!/usr/bin/php
<?php
function testForExploit($strUrl = NULL) {
// I would love to use “filter_var($strLongUrl, FILTER_VALIDATE_URL)” here,
// but let us be honest, it sucks even more than regular expressions do.
// (http://snipplr.com/view/14198/useful-regex-functions/)
if (!preg_match('/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*(?:\.[A-Z0-9][A-Z0-9_-]*)+):?(\d+)?\/?/i', $strUrl)) {
return false;
}
$oCurl = curl_init($strUrl);
@atomic-penguin
atomic-penguin / gist:1430882
Created December 4, 2011 18:16 — forked from bryanwb/gist:1430874
vmware-tools/attributes/default.rb
default['esx']['version'] = ""
default['esx']['tarball'] = ""
esx_hw_id = %x[ dmidecode | grep -A4 "BIOS Information" | grep 'Address:' ].split[1]
case esx_hw_id
when "0xEA550"
set['esx']['version'] = "4.0"
set['esx']['tarball'] = "VMwareTools-4.0.0-208167.tar.gz"
set['esx']['checksum'] = "f6f0d2fce35d2abdecf97a522c0b686f709758d37573a4b5dff7a86a17cc485a"
@atomic-penguin
atomic-penguin / gist:2355798
Created April 11, 2012 00:00 — forked from juanje/gist:1386361
Split a subdirectory into a new Git repo
# You need to install the command git-subtree from here:
# https://github.com/apenwarr/git-subtree
# Let's say you got a subdirectory 'lib-abc' under 'project' git repo that you like to
# split into a new repository
# First you need to create a bare repository, i.e. a Github project called 'lib-abc'
# Your new remote could be somethings like 'git@github.com:yourname/lib-abc.git'
cd project/
@atomic-penguin
atomic-penguin / app.config.erl
Created June 8, 2012 19:42 — forked from nathanaschbacher/myRole
Trying to override defaults in Riak chef cookbook for Riak Control user/pass
[
{bitcask, [
{data_root, "/var/lib/riak/bitcask"}
]},
{eleveldb, [
{data_root, "/var/lib/riak/leveldb"},
{max_open_files, 50}
]},
{kernel, [
{inet_dist_listen_max, 7999},
@atomic-penguin
atomic-penguin / download-jdk7.sh
Created July 31, 2012 15:11 — forked from obazoud/download-jdk7.sh
By pass Oracle license agreement
#!/bin/bash
JAVA_FILE_SOURCE="jdk-7u5-linux-x64.tar.gz"
REMOTE_JAVA_SDK="http://download.oracle.com/otn-pub/java/jdk/7u5-b05/${JAVA_FILE_SOURCE}"
wget --header "Cookie:oraclelicensejdk-7u5-oth-JPR=accept-securebackup-cookie;gpw_e24=http://edelivery.oracle.com" $REMOTE_JAVA_SDK --no-check-certificate
http://vialstudios.com/guide-authoring-cookbooks.html
http://vialstudios.logdown.com/posts/166848-the-environment-cookbook-pattern
http://www.youtube.com/watch?v=hYt0E84kYUI
http://www.youtube.com/watch?v=SYZ2GzYAw_Q
http://foodfightshow.org/
@atomic-penguin
atomic-penguin / spec_helper.rb
Last active August 29, 2015 14:04 — forked from hartmantis/spec_helper.rb
A spec helper library to stub recipes into isolation
require 'chefspec'
module SpecHelper
def global_stubs
# Don't worry about external cookbook dependencies
Chef::Cookbook::Metadata.any_instance.stub(:depends)
# Test each recipe in isolation, regardless of includes
@included_recipes = []
Chef::RunContext.any_instance.stub(:loaded_recipe?).and_return(false)