Skip to content

Instantly share code, notes, and snippets.

View jveldboom's full-sized avatar

John Veldboom jveldboom

View GitHub Profile
@jveldboom
jveldboom / class.move_db_files.php
Last active December 22, 2015 13:19
PHP class to move database files (like MYD, MYI and frm)
<?php
/*
|--------------------------------------------------------------------------
| Move Database Files (like MYD, MYI and frm)
|--------------------------------------------------------------------------
|
| $config = array(
| 'tables' => array('table1','table2'), // array of tables / filenames to move
| 'extensions' => array('MYD','MYI','frm'), // required extensions for each database
| 'from' => dirname(__DIR__).'/transfer', // from location of files
@jveldboom
jveldboom / gist:6481874
Created September 8, 2013 04:37
quick example
<?php
require_once app_path().'/libraries/google-api-php-client/src/Google_Client.php';
require_once app_path().'/libraries/google-api-php-client/src/contrib/Google_AnalyticsService.php';
session_start();
$client = new Google_Client();
$client->setApplicationName("Google Analytics PHP Starter Application");
// Visit https://code.google.com/apis/console?api=analytics to generate your
@jveldboom
jveldboom / bisac.csv
Created September 12, 2013 18:52
BISAC codes and values
ANT000000 Antiques & Collectibles / General
ANT001000 Antiques & Collectibles / Americana
ANT002000 Antiques & Collectibles / Art
ANT003000 Antiques & Collectibles / Autographs
ANT005000 Antiques & Collectibles / Books
ANT006000 Antiques & Collectibles / Bottles
ANT007000 Antiques & Collectibles / Buttons & Pins
ANT008000 Antiques & Collectibles / Care & Restoration
ANT009000 Antiques & Collectibles / Transportation
ANT010000 Antiques & Collectibles / Clocks & Watches
@jveldboom
jveldboom / class.onixSplitter.php
Created March 11, 2014 15:13
Split ONIX files into smaller chunks
<?php
class onixSplitter
{
function split($file,$header,$footer,$split_at=2000)
{
$this->file = $file;
$this->header = $header;
$this->footer = $footer;
$this->split_at = $split_at;
$this->write_num = 1; // starting number for files written
@jveldboom
jveldboom / readme.md
Last active March 18, 2018 20:37
Unbuntu 14.04 Vagrant LEMP + Laravel
### Download setup Ubuntu 14.04 box
```
// from local directory
vagrant init chef/ubuntu-14.04
```
### Setup Vagrantfile
```
# -*- mode: ruby -*-
# vi: set ft=ruby :
@jveldboom
jveldboom / json.lua
Last active October 9, 2015 06:38
Heka JSON Decoder
require "cjson"
local dt = require "date_time"
--[[
From trink in IRC - thanks!
Example use:
[HttpListenInput]
address = "0.0.0.0:8325"
@jveldboom
jveldboom / SystemStats.php
Created October 30, 2014 20:51
Combine sar system stats
<?php
/**
* sar documentation http://linux.die.net/man/1/sar
*/
class SystemStats
{
function __construct($sar)
{
$this->sar = $sar;
}
<?php
require '../includes/class.common.php';
require '../includes/class.images.php';
$common = new common;
$images = new images;
// mysql connection
$conn=mysqli_connect("localhost","database","password","database_name");
// Check connection
if (mysqli_connect_errno($conn)) {
@jveldboom
jveldboom / heka-system.conf
Created January 21, 2015 13:44
monit heka config
check process hekad-system with pidfile /var/run/hekad-system.pid
start program = "/bin/bash -c 'hekad --config=/usr/share/heka/conf.d/system.toml'" with timeout 60 seconds
stop = "/bin/bash -c 'kill -s SIGTERM `cat /var/run/hekad-system.pid`'"
@jveldboom
jveldboom / gist:87615b2a5d49ac04e2c3
Created February 20, 2015 20:36
Apache prefork
<?php
$workers = 400;
//10000
echo 'StartServers '.($workers * .3).PHP_EOL;
echo 'MinSpareServers '.($workers * .05).PHP_EOL;
echo 'MaxSpareServers '.($workers * .10).PHP_EOL;
echo 'ServerLimit '.($workers).PHP_EOL;
echo 'MaxRequestWorkers '.($workers).PHP_EOL;
echo 'MaxRequestsPerChild 10000';