Skip to content

Instantly share code, notes, and snippets.


Michael Bensoussan mickey

View GitHub Profile
View gist:b4e9b2a13a09e8ddce9d6c9c4dfd87ec
### Keybase proof
I hereby claim:
* I am mickey on github.
* I am mickeyben ( on keybase.
* I have a public key ASAMLI13WijX3byEVs_4bbGefvph2wvSeO3nSVB8E9GEGAo
To claim this, I am signing this object:
View with_mem.sql
SELECT w.service_class, CASE w.service_class
WHEN 6 THEN 'etl'
WHEN 7 THEN 'data'
WHEN 8 THEN 'viz'
WHEN 9 THEN 'default'
e.exec_50th, e.exec_75th, e.exec_95th, e.exec_99th,
q.queue_50th, q.queue_75th, q.queue_95th, q.queue_99th,
m.mem_50th, m.mem_75th, m.mem_95th, m.mem_99th
FROM stl_wlm_query w
mickey / active_record_json_spec.rb
Created May 1, 2017
ActiveRecord patches for partial SPATIAL and JSON support in MySQL
View active_record_json_spec.rb
require "spec_helper"
describe ActiveRecord::Type::JSON do
class TestJSON < ActiveRecord::Base
before do
connection = ActiveRecord::Base.connection
if connection.table_exists?(:test_jsons)
View brew.rb
#!/usr/bin/env ruby
# <bitbar.title>Brew Services</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <>Adam Lindberg</>
# <>eproxus</>
# <bitbar.desc>Shows and manages Homebrew services.</bitbar.desc>
# <bitbar.image></bitbar.image>
# <bitbar.dependencies>ruby, brew, brew-services</bitbar.dependencies>

Instructions: solve the levels in ascending order, and send your code and data at when you’re done. We love SQL tricks, but we also value your ease to write code. You can use any langage you like as long as you have a strategy to deploy and maintain this code.

Goal: Provide the BI team a report of the occupancy rate of the fleet per city.

For a certain half-day, we define the occupancy rate as the nb of rented cars / nb of available cars.

For a half day T, a car is considered available by default. This default state can be changed to:

mickey / gist:9073d274220e8684047a
Created Nov 28, 2014
WeightedSampler -> Randoms with weight
View gist:9073d274220e8684047a
class WeightedSampler
def initialize(items)
@items = normalize(items)
def sample(num = nil)
return get_sample unless num { get_sample }
mickey /
Created Sep 4, 2013
Bugsnag unresolved issues widget for Dashing


Simple Dashing job to display total number of unresolved issues from BugSnag.



mickey /
Created Sep 4, 2013
Dashing widget to track the number of applications for the dashing widget challenge.
View gist:5267665
module.exports = function(grunt) {
// Project configuration.
View gist:4110549
"keys": ["ctrl+alt+left"],
"command": "set_layout",
"cols": [0.0, 0.33, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]