Skip to content

Instantly share code, notes, and snippets.

View salgo's full-sized avatar

Andy Gale salgo

View GitHub Profile
if (${DOLLAR}http_x_forwarded_proto != "https") {
rewrite ^(.*)${DOLLAR} https://${DOLLAR}server_name${DOLLAR}1 permanent;
}
@salgo
salgo / convert.php
Last active June 6, 2017 14:24
Convert Barclaycard commercial to freeagent CSV format
<?php
$row = 0;
if ($argc != 4) {
die('Expected 3 arguments: php convert.php $input_file $output_file $after_date' . "\n");
}
date_default_timezone_set('Europe/London');
<?php
function colours($red, $green, $blue) {
if ($red > $green) {
if ($red > $blue) {
return 'red';
} else if ($blue > $red) {
return 'blue';
}
} else if ($green > $red) {
Fuck you, I won't do what you tell me
Fuck you, I won't do what you tell me
Fuck you, I won't do what you tell me
Fuck you, I won't do what you tell me
Fuck you, I won't do what you tell me
Fuck you, I won't do what you tell me
Fuck you, I won't do what you tell me
Fuck you, I won't do what you tell me
Fuck you, I won't do what you tell me!
Fuck you, I won't do what you tell me!
[SSH] opening connection to vagrant@127.0.0.1:2222<{:user_known_hosts_file=>"/dev/null", :paranoid=>false, :keys_only=>true, :port=>"2222", :keys=>["/Users/andy/Work/adaptivehosting/adaptivehosting-lamp/.kitchen/kitchen-vagrant/default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key"]}>
ssh vagrant@127.0.0.1 -p 2222 -i /Users/andy/Work/adaptivehosting/adaptivehosting-lamp/.kitchen/kitchen-vagrant/default-ubuntu-1404/.vagrant/machines/default/virtualbox/private_key
execute 'create-ssh-key-' + account_id do
user account_id
cwd user_home
environment(
'HOME' => user_home,
'USER' => account_id
)
command 'ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa'
not_if { ::File.exist?(File.join(user_home, '.ssh', 'id_rsa')) }
end
require 'spec_helper'
describe package('httpd'), :if => os[:family] == 'redhat' do
it { should be_installed }
end
describe package('apache2'), :if => os[:family] == 'ubuntu' do
it { should be_installed }
end
Hi Andy,
Yes certainly, I need some information from you please:
Address:
Contact number:
Card details to confirm the booking, you can call with these if you wish,
Card type:
@salgo
salgo / curl-test.php
Created October 7, 2014 14:06
Funky bit of PHP for testing curl
<?php
if ($argc == 1) {
die("Specify a url!");
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $argv[1]);
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@salgo
salgo / gist:3208d2d29d13881e03d1
Created October 6, 2014 09:25
Little bit of bash to remove the current cookbook tag :)
#!/usr/bin/env bash
VERSION=`grep 'version' metadata.rb | grep -o "[0-9.]" | tr -d '\n'''`
git tag -d $VERSION
git push origin :refs/tags/$VERSION