Skip to content

Instantly share code, notes, and snippets.

@gboudreau
gboudreau / greyhole-custom-debug.sh
Last active August 29, 2015 14:02
Greyhole debugging
#!/bin/sh
{
ls -la /mnt/GreyholeHDDs/*/GH/Media/TV\ Shows/Breaking\ Bad/Season\ 01
ls -la /mnt/GreyholeHDDs/1TbSeagate/LZ/Media/TV\ Shows/Breaking\ Bad/Season\ 01
} > /tmp/greyhole_sysinfo_3
echo "Here's the URL you will need to give the to person who's helping you:"
cat /tmp/greyhole_sysinfo_3 | curl -F 'sprunge=<-' http://sprunge.us
echo

I'm writing in response to events that have recently come to light involving a sexual assault at a tech conference. Background information can be found [here][1], [here][2], and [here][3] as well as on twitter and google.


I've been watching this from the sidelines, and I've been wrestling with several questions that I can't seem to shake and that I really don't have answers to.

I wear many hats, both in the tech community and others. I'm a coder, a speaker, a user group organizer, a conference organizer, and even a boss. Each of those roles colors how I see this, but there's one role that is overpowering in my reaction.

See, I'm a Dad. A dad of two beautiful and innocent girls who are 3 and 2. They have their whole lives in front of them and so the questions I'm struggling with are:

@gboudreau
gboudreau / gist:5206966
Created March 20, 2013 18:03
Correctly handle errors with valid SSL certificates in cURL/PHP. Use this if you have problems connecting to https websites using PHP cURL extension. If the certificate is not signed by a CA listed in cURL's cacert.pem, you can use this technique to verify the certificate: http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssl…
<?php
// [...]
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); // for security this should always be set to true.
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // for security this should always be set to 2.
// Update cacert.pem (valid CA certificates list) from the cURL website once a month
$curl_cainfo = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'cacert.pem';
$last_month = time()-30*24*60*60;
@gboudreau
gboudreau / gh-du.php
Last active October 13, 2015 09:18
Greyhole Disk Usage Report Browser
<?php
# How to use: https://github.com/gboudreau/Greyhole/wiki/How-to-visualize-used-disk-space-in-your-storage-pool
header('Content-Type: text/html; charset=utf8');
setlocale(LC_CTYPE, "en_US.UTF-8");
if (!file_exists('/usr/share/greyhole/gh-disk-usage.log')) {
die("Error: /usr/share/greyhole/gh-disk-usage.log file not found.<br/>You need to run 'greyhole --fsck --disk-usage-report' to generate this file.");
}
@gboudreau
gboudreau / saved_plan.js
Created May 17, 2012 21:36
OTP display saved API response
// bougu@Netlift: this allows us to display the OTP UI with a predefined apiResponse (XML)
otp.planner.Forms.prototype.submitSuccessXML = function(response)
{
var responseXML;
if (window.DOMParser)
{
var parser=new DOMParser();
responseXML=parser.parseFromString(response,"text/xml");
}
else // Internet Explorer
@gboudreau
gboudreau / flickr-api-proxy.php
Created April 8, 2012 11:09
Flickr API proxy for Apple TV - Details: http://www.pommepause.com/blog/?p=530
<?php
$served_by = '';
if ($_GET['method'] == 'flickr.photos.search') {
if (strpos($_GET['text'], 'group:') === 0) {
$group_name = trim(substr($_GET['text'], 6));
$served_by = 'group.' . str_replace(' ', '_', $group_name) . '.';
$xml = file_get_contents('http://api.flickr.com/services/rest/?method=flickr.groups.search&api_key=' . $_GET['api_key'] . '&text=' . urlencode($group_name));
$xml = simplexml_load_string($xml);
$attr = $xml->groups->group->attributes();
@gboudreau
gboudreau / mount_shares_locally
Last active September 14, 2020 03:57
mount_shares_locally for Fedora/CentOS
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mount_shares_locally
# Required-Start: $network $local_fs $remote_fs smb mysqld
# Required-Stop: $network $local_fs $remote_fs smb
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: mount Samba shares locally
### END INIT INFO
@gboudreau
gboudreau / recursive_include_parser-test.php
Created January 29, 2012 12:46
Testing recursive_include_parser function for Greyhole
<?php
file_put_contents('file1',
"this is file 1\r
include = file2
include = file3 # comment");
file_put_contents('file2', "this is file 2");
file_put_contents('file3',
@gboudreau
gboudreau / smbln
Created January 3, 2012 22:23
smbln executable that allows the creation of symlinks on Samba shares mounted with the mfsymlinks option
#!/usr/bin/php
<?php
if ($argv[1] == '-s') {
$argv[1] = $argv[2];
$argv[2] = @$argv[3];
}
if (empty($argv[2])) {
$argv[2] = basename($argv[1]);
@gboudreau
gboudreau / jsonpp
Created December 5, 2011 14:38
JSON pretty-print from the command line
#!/usr/bin/php
<?php
echo json_format(file_get_contents('php://stdin')) . "\n";
// Pretty print some JSON
function json_format($json)
{
$tab = " ";
$new_json = "";
$indent_level = 0;
$in_string = false;