Skip to content

Instantly share code, notes, and snippets.

View nono's full-sized avatar

Bruno Michel nono

  • Cozy Cloud
  • Paris, France
View GitHub Profile
@nono
nono / conv.go
Last active December 18, 2015 01:39 — forked from jeromenerf/gist:5679866
package main
import (
"fmt"
proj "github.com/pebbe/go-proj-4/proj"
)
const (
// Epsg = "+init=epsg:27572"
Epsg = "+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=2.33722917 +k_0=0.99987742 +x_0=600000 +y_0=2200000 +a=6378249.2 +pm=paris +units=m +no_defs no_defs <>"
@nono
nono / blowfish.rb
Created June 26, 2012 10:57
How to encrypt and decrypt Blowfish in Ruby 1.9 with https://github.com/drench/blowfish.js
#!/usr/bin/env ruby
require "openssl"
class BF < Struct.new(:key, :pad_with_spaces)
def encrypt(str)
cipher = OpenSSL::Cipher.new('bf-ecb').encrypt
if pad_with_spaces
str += " " until str.bytesize % 8 == 0
cipher.padding = 0
def long_filename
sha1 = File.read('sha1').chomp
"my_prog-#{sha1}"
end
file "archive.tgz" do
Rake::Task[:build].invoke
`tar cvzf archive.tgz #{long_filename}`
end
@nono
nono / hello.go
Created April 7, 2012 21:14
A HTTP version of Hello world in Go
package main
import (
"encoding/json"
"flag"
"github.com/bmizerany/pat"
"io"
"log"
"net/http"
)
@nono
nono / mix_periods.rb
Created February 29, 2012 12:30 — forked from shingara/mix_periods.rb
Method to compare if some periods define by start_date and end_date are mixed
def mix_periods
list_period = seasons.inject([]) do |acc, season|
season.periods.inject(acc) do |a,period|
a << (period.start_date..period.end_date); a
end
end
until list_period.empty?
period_test = list_period.pop
if list_period.any?{|lp| period_test.cover?(lp.begin) || lp.cover?(period_test.begin) }
@nono
nono / gist:1600053
Created January 12, 2012 11:48 — forked from athoune/gist:1599957
autocomplete with tire
#encoding: utf-8
require 'tire'
require 'json'
require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/object/to_param'
conf = {
settings: {
number_of_shards: 1,
number_of_replicas: 0,
@nono
nono / rails_log_stathat.rb
Created December 30, 2011 11:07
Parse a Rails log file and send metrics to stathat
#!/usr/bin/env ruby
require 'net/http/persistent'
require 'uri'
require 'thread'
USAGE = <<EOS
Parse a Rails log file and send metrics to stathat
export EMAIL=email
@nono
nono / redis2txt.rb
Created November 28, 2011 23:29
Export data from redis to a plain text files
#!/usr/bin/env ruby
require "redis"
redis = Redis.new
redis.keys("*").each do |key|
val = case redis.type(key)
when "string"
redis.get key
when "list"
@nono
nono / gist:1237214
Created September 23, 2011 12:20 — forked from shingara/gist:1237097
Comment répondre qu'on a pas de temps libre extensible pour créer un site internet sans être payé.
Je suis désolé, mais je ne correspond pas à ce que vous cherchez. Développer un site internet tel que celui-ci prend plusieurs mois hommes.
Je n'ai personnellement que 3 heures par semaine de disponible actuellement en dehors de mon travail de salarié chez bemyboat, de CTO chez supermarmite et de père de famille.
Je ne pourrais donc pas vous aider à moins que vous ne soyez prêt à patienter plusieurs années pour avoir une version beta.
Cordialement,
Cyril Mougel
@nono
nono / Makefile
Created June 27, 2011 10:53
Stressing my long-polling server
include $(GOROOT)/src/Make.inc
TARG=go-bench
GOFILES=go-bench.go
include $(GOROOT)/src/Make.cmd