Skip to content

Instantly share code, notes, and snippets.

@gorenje
gorenje / gist:4474747
Last active December 10, 2015 18:28
what i did last month
====> .gitconfig
[alias]
lsloglastmonth = log --pretty=format:"%ci\\ %C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]%Creset" --decorate --after='last month' --before='today' --no-merges
====> .bashrc
function _funct_gitlog_last_month
{
local lastmonth=`gdate '+%Y-%m-01' --date '1 month ago'`
for n in */.git
do
===> old code
def send_gauge_metric(gauge, time, source, value)
uri = URI.parse("https://metrics-api.librato.com/v1/gauges/#{gauge}.json")
req = Net::HTTP::Post.new(uri.path)
req.basic_auth ApiKeys.librato.username, ApiKeys.librato.password
req.set_form_data('measure_time' => time.to_i,
'period' => 60,
'value' => value,
@gorenje
gorenje / .emacs
Created February 26, 2013 13:30
emac configuration file
;;; -*- MODE: LISP-INTERACTION -*-
(require 'mmm-mode)
(require 'mmm-auto)
(require 'saveplace)
;;(require 'psvn)
;;; THIS IS A SAMPLE .EMACS FILE.
;;;
;;; The .emacs file, which should reside in your home directory, allows you to
;;; customize the behavior of Emacs. In general, changes to your .emacs file
;;; will not take effect until the next time you start up Emacs. You can load
## leave running
while [ 1 ] ; do curl -v "http://mops-eccrine.herokuapp.com/?campaign=FUABRpingdom&network=pingdom" 2>&1 >/dev/null | awk '/Trying/ { printf $3; } /[<] HTTP\/1.1/ { print $3 " " $4; }'; done | tee -a results.txt
## then
sort results.txt | uniq -c | grep -v "0 0"
parse_git_branch ()
{
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
local a="";
lb=${ref#refs/heads/};
local ro=$(git config --get branch.${lb}.remote || echo "origin");
local rb=$(git config --get branch.${lb}.merge);
rb=${rb#refs/heads/};
local ab=;
if [ "" != "${rb}" ]; then
@gorenje
gorenje / timer.ino
Last active December 24, 2015 20:09
// -*- c -*-
#define MINUTES(x) x * 60L * 1000L
#define HOURS(x) x * MINUTES(60L)
/*
* Pin 10 is the light
* Pin 9 is the pump
*/
#define PUMP_PIN 9
@gorenje
gorenje / temp.md
Last active August 29, 2015 14:24

Woogas Office Weather - Wow!

At Wooga, we're very conscious about our work environment and the happiness of everyone working here. So when some Woogas moved to 3rd floor in winter and began to feel tired and complain of headaches, we knew something was not right.

After a bit of research, we came up with the idea that perhaps the air could a little to sticky. So we decided to start measuring the CO2 levels.

require 'rubygems'
require 'fileutils'
#require 'active_record'
#require 'sqlite3'
#require 'readline'
require 'ostruct'
#require 'ruby-prof'
require 'optparse'
require 'hpricot'
require 'addressable/uri'