Skip to content

Instantly share code, notes, and snippets.

Avatar

Neil Millard neilmillard

View GitHub Profile
@neilmillard
neilmillard / etc-logstash-forwarder
Last active Aug 29, 2015
logstash forwarder install
View etc-logstash-forwarder
{
"network": {
"servers": [ "kibana.ipaddr:5000" ],
"timeout": 15,
"ssl ca": "/etc/pki/tls/certs/logstash-forwarder.crt"
},
"files": [
{
"paths": [
"/var/log/messages",
View Google2FA.php
<?
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@neilmillard
neilmillard / PDO_MySQL.php
Created Jul 29, 2014
kohana 3.2 pdo_mysql
View PDO_MySQL.php
<?php defined('SYSPATH') or die('No direct script access.');
class Database_PDO_MySQL extends Database_PDO {
public function list_columns($table, $like = NULL, $add_prefix = TRUE)
{
// Quote the table name
$table = ($add_prefix === TRUE) ? $this->quote_table($table) : $table;
if (is_string($like))
{
View ember-build.sh
ember build
cp dist/index.html app/views/app.php
cp -r dist/assets public/assets
View emberinstall.sh
# Install git
sudo apt-get install git -y
# Install node.js and npm
sudo apt-get install nodejs-legacy -y
sudo apt-get install npm -y
# Install bower
npm install -g bower
View Manager.php
<?php
namespace Acme\Validation\Capsule;
use Illuminate\Validation\Factory;
use Illuminate\Validation\DatabasePresenceVerifier;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Translation\TranslatorInterface;
use Illuminate\Translation\Translator;
@neilmillard
neilmillard / tradecalc.php
Created Feb 27, 2015
note to calculate price
View tradecalc.php
<?php
$highMid ="1.55515";
$lowMid = "1.5534";
function toPips($price)
{
return is_int($price) ? $price / 10000 : $price;
}
$spread = 5;
$high = ((float) substr(sprintf("%.4f", $highMid),0,6)) + toPips($spread);
View init.pp
class
{
"nm::webserver":
php_date_timezone => $php_date_timezone,
php_memory_limit => $php_memory_limit,
php_upload_max_filesize => $upload_max_filesize,
php_post_max_size => $php_post_max_size,
}
View RadarChart.js
//Practically all this code comes from https://github.com/alangrafu/radar-chart-d3
//I only made some additions and aesthetic adjustments to make the chart look better
//(of course, that is only my point of view)
//Such as a better placement of the titles at each line end,
//adding numbers that reflect what each circular level stands for
//Not placing the last level and slight differences in color
//
//For a bit of extra information check the blog about it:
//http://nbremer.blogspot.nl/2013/09/making-d3-radar-chart-look-bit-better.html
View aws-user-data-file.sh
#!/bin/sh
AWS_ACCESS_KEY="abcdefghijlmnopqrstu"
AWS_SECRET_KEY="abcdefghijlmnopqrstuabcdefghijlmnopqrstu"
BUCKET_PUPPET="puppet"
#export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY
#export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KEY
#export AWS_DEFAULT_REGION=eu-west-1
# update packages