Skip to content

Instantly share code, notes, and snippets.

View stelcheck's full-sized avatar

Marc Trudel stelcheck

View GitHub Profile
@stelcheck
stelcheck / gist:1604806
Created January 13, 2012 05:25
Example TryCatch
/** MySQL Table structure:
--
-- Table structure for table `actors`
--
CREATE TABLE IF NOT EXISTS `actors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'test',
`creation` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
@stelcheck
stelcheck / gist:1620003
Created January 16, 2012 09:43
Where try catch will get the wrong idea...
var http = require("http"),
fs = require("fs"),
colors = require("colors"),
util = require("util"),
trycatch = require("trycatch"),
events = require("events");
console.log("Creating Web Server...".grey);
// We create the emit object - Imagine this is a server instance
@stelcheck
stelcheck / changes.diff
Created March 15, 2012 14:18
Suggested changes
diff --git a/lib/puppet/provider/package/pear.rb b/lib/puppet/provider/package
index 013b6b6..d595b47 100644
--- a/lib/puppet/provider/package/pear.rb
+++ b/lib/puppet/provider/package/pear.rb
@@ -22,7 +22,7 @@ Puppet::Type.type(:package).provide :pear, :parent => Puppet
begin
list = execute(command).collect do |set|
if hash[:justme]
- if set =~ /^hash[:justme]/
+ if set[0,hash[:justme]].downcase == hash[:justme].downcase
@stelcheck
stelcheck / hbase.rest.scanner.filters.md
Created October 30, 2012 10:00
HBase Stargate REST API Scanner Filter Examples

Stargate Scanner Filter Examples

Introduction

So yeah... no documentation for the HBase REST API in regards to what should a filter look like...

So I installed Eclipse, got the library, and took some time to find some of the (seemingly) most useful filters you could use. I'm very green at anything regarding HBase, and I hope this will help anyone trying to get started with it.

What I discovered is that basically, attributes of the filter object follow the same naming than in the documentation. For this reason, I have made the link clickable and direct them to the HBase Class documentation attached to it; check for the instantiation argument names, and you will have your attribute list (more or less).

@stelcheck
stelcheck / add_this_to_your_bash_profile.sh
Created July 11, 2013 01:22
Pretty print QOTD server quote on shell open
#!/usr/bin/env bash
if [ ! -d ~/.bash.d ]; then
pushd ~;
git clone https://github.com/stelcheck/libbash.git .bash.d;
popd;
fi
. ~/.bash.d/colorize.sh
. ~/.bash.d/networking.sh
@stelcheck
stelcheck / gist:6161424
Created August 6, 2013 02:12
Cozycloud / Trying to run Vagrant Manually...
└──╼ vagrant -v
There is a syntax error in the following Vagrantfile. The syntax error
message is reproduced below for convenience:
/Users/mt/Sources/cozymyadmin/Vagrantfile:31: syntax error, unexpected ':', expecting kEND
config.vm.network :private_network, ip: "192.168.50.4"
^
/Users/mt/Sources/cozymyadmin/Vagrantfile:36: syntax error, unexpected ':', expecting kEND
...etwork :forwarded_port, guest: 9101, host: 9101 # Cozy Data ...
^
{
"_id": "31bde843db0e16877560b19b5800c021",
"_rev": "4-f42e5293293b107cbf1bff8934adb450",
"title": "IMG-20121219-WA0004.jpg",
"description": "undefined",
"albumid": "31bde843db0e16877560b19b58008e5f",
"docType": "Photo",
"_attachments": {
"raw": {
"content_type": "image/jpeg",
@stelcheck
stelcheck / gist:6866552
Created October 7, 2013 11:50
set_fact or shell?
- name: If undefined set bootstrap to the first node of the cluster
set_fact:
bootstrap: "{{ groups[cluster_name]|first }}"
when: bootstrap == False or bootstrap is not defined
tags:
- couchbase
- bootstrap
- name: Check if the current machine is part of the cluster
shell: >
@stelcheck
stelcheck / gist:6881400
Created October 8, 2013 08:25
yum and copy
- name: Copy required core collectd RPM packages
copy: >
src={{ item }}-{{ version }}.rpm
dest=/tmp/{{ item }}-{{ version }}.rpm
with_items: packages
tags:
- collectd
- pkgs
- libs
@stelcheck
stelcheck / gist:7723362
Created November 30, 2013 19:24
CouchDB error
[Sat, 30 Nov 2013 19:23:17 GMT] [error] [<0.81.0>] ** Generic server disksup terminating
** Last message in was {'EXIT',#Port<0.1748>,normal}
** When Server state == [{data,[{"OS",{unix,linux}},
{"Timeout",60000},
{"Threshold",100},
{"DiskData",
[{"/",8256952,19},
{"/dev/shm",3756944,0},
{"/var/lib/couchdb",103212320,45}]}]}]
** Reason for termination ==