Skip to content

Instantly share code, notes, and snippets.

## 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"
@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
===> 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 / 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
@gorenje
gorenje / xmas.ino
Last active December 10, 2015 07:28
Ardunio Xmas Tree
// -*- c -*-
#define TO_INT(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \
(256*arg1) + (128*arg2) + (64*arg3) + (32*arg4) + (16*arg5) + \
( 8*arg6) + ( 4*arg7) + ( 2*arg8) + ( 1*arg9)
const int lookup[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256 };
const int SwitchPin = 13;
const int SwitchPin2 = 12;
@gorenje
gorenje / gist:3999947
Created November 2, 2012 10:16
TravisCI Private Builds - private repo which references a private gem can't build

Scenario:

Private repo which references a private gem can't be built because the gem can't be checked out. The gem in question is installed via bundler and a Gemfile.

Question:

I saw in the output of the test that TravisCI creates a id_rsa key:

@gorenje
gorenje / gist:3972903
Created October 29, 2012 10:42
get-password.rb
#!/usr/bin/ruby
#
# Author: Gerrit Riessen, [email protected]
# Copyright (C) 2009 Gerrit Riessen
# This code is licensed under the GNU Public License.
#
# $Id$
require 'rubygems'
require 'fileutils'
@gorenje
gorenje / gist:3076191
Created July 9, 2012 12:26
how to use Zendesk API Gem
require 'zendesk_api'
# retrieve login details from yml file.
z = get_login_details(:zendesk)
client = ZendeskAPI::Client.new do |config|
config.url = "https://#{z.first}.zendesk.com/api/v2"
config.username = z[1]
config.password = z.last
require 'logger'