Skip to content

Instantly share code, notes, and snippets.

View sebthemonster's full-sized avatar

sebthemonster

  • Bordeaux, France
View GitHub Profile
#!/bin/bash
#================================================================
# HEADER
#================================================================
#% SYNOPSIS
#+ ${SCRIPT_NAME} [-hv] [-o[file]] args ...
#%
#% DESCRIPTION
#% This is a script template
#% to start any good shell script.
@sebthemonster
sebthemonster / README.md
Last active August 29, 2015 14:07
A little script to parse http server logs with Piwik (piwik.org) script. Log files are in a given directory with sub-directories for each website present in Piwik. Each website has an idsite in Piwik and this idsite is passed to parser script via a piwik.conf file present in website directory

Script parsing logs to Piwik analytics

Create web site

  1. Create website in Piwik and get its idsite
  2. Create a directory for this website in /home/analytics/website_logs/ and create in it a directory parsed

For example.org, create /home/analytics/website_logs/example.org dir and /home/analytics/website_logs/example.org/parsed

@sebthemonster
sebthemonster / An-Anonymous-Pen.markdown
Last active December 26, 2015 07:49 — forked from anonymous/An-Anonymous-Pen.markdown
Great Transformations on menu icon ;)
@sebthemonster
sebthemonster / bootstrap_form_builder.rb
Created October 19, 2012 08:51 — forked from ivliaspiration/bootstrap_form_builder.rb
Twitter Bootstrap FormBuilder
# FormBuilder for Ruby on Rails which produces HTML code compatible with Twitter Bootstrap
# horizontal forms styles (see here: http://twitter.github.com/bootstrap/base-css.html#forms)
#
# Features:
# * displays validation errors in-line
# * has custom option - label-text - to override default label text for an input
#
# Requirements:
# By default, Rails will wrap a field with validation error in an ugly div tag that breaks
# the layout. To override this behaviour, add
class Object
def to_boolean
compare_value = self.class == String ? self.downcase : self
case compare_value
when "no","false",false, "0", 0
false
when "yes","true",true, "1", 1
true
else
!!compare_value
@sebthemonster
sebthemonster / USAGE
Created May 22, 2012 14:22
A Module to decoupling persistence from business model
#models/article.rb :
require 'persistence_mapper'
require_relative '../persistence/lotissement'
class Article
include Persistence::Mapper
end
#persistence/article.rb :
module Persistence
@sebthemonster
sebthemonster / pre-commit.rspec.rb
Created October 25, 2011 18:47 — forked from david-hodgetts/pre-commit
pre-commit git hook, runs rspec if branch is master
#!/usr/bin/env ruby
# pre-commit git hook
# will run rspec if and only if current branch is master
# script adapted from http://book.git-scm.com/5_git_hooks.html
# source : https://gist.github.com/1141992
NO_COMMIT_MESSAGE = "\aDID NOT COMMIT YOUR FILES!"
FORMAT = :html