Skip to content

Instantly share code, notes, and snippets.

Avatar

Marc Trudel stelcheck

View GitHub Profile
@stelcheck
stelcheck / gist:1604806
Created Jan 13, 2012
Example TryCatch
View gist:1604806
/** 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 Jan 16, 2012
Where try catch will get the wrong idea...
View gist:1620003
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 Mar 15, 2012
Suggested changes
View changes.diff
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 Oct 30, 2012
HBase Stargate REST API Scanner Filter Examples
View hbase.rest.scanner.filters.md

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 Jul 11, 2013
Pretty print QOTD server quote on shell open
View add_this_to_your_bash_profile.sh
#!/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 Aug 6, 2013
Cozycloud / Trying to run Vagrant Manually...
View gist:6161424
└──╼ 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 ...
^
View CozyCloud album image
{
"_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 Oct 7, 2013
set_fact or shell?
View gist:6866552
- 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: >
View gist:6881400
- name: Copy required core collectd RPM packages
copy: >
src={{ item }}-{{ version }}.rpm
dest=/tmp/{{ item }}-{{ version }}.rpm
with_items: packages
tags:
- collectd
- pkgs
- libs
View gist:7723362
[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 ==