Skip to content

Instantly share code, notes, and snippets.

View madx's full-sized avatar

François Vaux madx

View GitHub Profile
create or replace function acte_possible
(code in varchar2, day in date, creneau_min in number)
return number
is
nb_actes number;
cursor services_ouverts is
select s.NumService
from Service s
left join EstOuvert eo on s.NumService = eo.NumService
left join EstCompetent ec on s.NumService = ec.NumService
~ $ df -h
Sys. de fich. Tail. Occ. Disp. %Occ. Monté sur
/dev/sda1 6,5G 6,0G 183M 98% /
[...]
# Looks like I'm running short of space :D
# Step 1:
~ $ sudo gem1.8 cleanup
[... lots of text ...]
@madx
madx / git-dot
Created February 4, 2010 18:16
Generate graphs from a git repository
#!/usr/bin/env ruby
class Grapher
class << self
Props = {
:branch => '[shape=box,style=filled,fillcolor="#ccffcc",color="#003300"]',
:commit => '[style=filled,fillcolor="#ffffcc",color="#663333"]',
:ref => '',
:relation => '[dir=back,color="#545443"]',
@madx
madx / honk.rb
Created December 17, 2009 16:26
require 'time'
require 'pathname'
module Honk
extend self
attr_reader :posts, :tags
@posts = []
@tags = {}
class SplitLog < Sequel::Migration
def up
alter_table :comments do
add_foreign_key :entry_id, :entries
end
alter_table :entries do
drop_column :url
add_column :author, String
end
require 'fileutils'
# ShitStorm libs
require File.join(File.dirname(__FILE__), '..', 'lib', 'shitstorm')
include ShitStorm
# Swap to test DB
db_file = File.join(File.dirname(__FILE__), 'test.db')[2..-1]
migrations_dir = File.join(File.dirname(__FILE__), '..', 'migrations')
@madx
madx / to_filter.rb
Created November 4, 2009 09:40
Transform a text query to a Sequel filter
def to_filter(query)
query.split(/ +/).map { |chunk|
case chunk
when /^by:(.+)/
{:author => $~[1]}
when /^is:(.+)/
{:status => $~[1]}
else
:title.like("%#{chunk}%")
end
bit $ ./bit ls
./bit: no issues yet.
bit $ ./bit open
>> This is my first issue
[some editing in your favorite editor]
./bit: created issue 1.
bit $ ./bit open
[some editing again]
>> Another one
./bit: created issue 2.
ditz $ ditz add
Title: Hello
Description (ctrl-d, ., or /stop to stop, /edit to edit, /reset to reset):
> Make a Hello world
> .
Is this a (b)ugfix, a (f)eature, or a (t)ask? t
Issue creator (enter for "madx <[email protected]>"):
Comments (ctrl-d, ., or /stop to stop, /edit to edit, /reset to reset):
> Lol.
> .
#!/bin/bash
ISSUES=/home/madx/repos/mine/bit/issues
function bit_nl() { nl -nln -w1 -s $@ }
function bit_before() {
line="$(bit_nl $ISSUES)"
}
function bit_chunk() {