Skip to content

Instantly share code, notes, and snippets.

#! /bin/bash
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF
DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
CODENAME=$(lsb_release -cs)
echo "deb http://repos.mesosphere.io/${DISTRO} ${CODENAME} main" | sudo tee /etc/apt/sources.list.d/mesosphere.list
sudo apt-get -y update --fix-missing
sudo apt-get -y install mesosphere
require 'continuation'
#
# Messing around with mimicking Scheme in Ruby by implementing the Yin/Yang puzzle with Kernel#callcc and a fake 'let' macro
#
# See also:
# http://blog.gonzih.me/blog/2013/11/26/yin-yang-callcc-puzzle-in-ruby/,
# http://stackoverflow.com/questions/16843853/how-to-implement-let-in-scheme
#
# In Scheme (the original)
# This script just get the latest tracks of your friends on Last.fm and recommends those more popular.
# It's all based on a conversation between @mort, @rochgs, @littlemove and me (mainly by @mort)
# INSTRUCTIONS
# 1. Install lastfm gem: https://github.com/youpy/ruby-lastfm/
# gem install lastfm
# 2. Get a Last.fm API Key on http://www.lastfm.es/api
require 'lastfm'
@rgaidot
rgaidot / elasticoverflow.rb
Created May 4, 2011 00:10 — forked from karmi/elasticoverflow.rb
Importing and searching RSS with ElasticSearch and Tire
# =======================================================
# Importing and searching RSS with ElasticSearch and Tire
# =======================================================
#
# This script downloads, parses and indexes Stackoverflow RSS feed with ElasticSearch
# via the [Tire](https://github.com/karmi/tire) Rubygem.
#
# Requirements
# ------------
#
@rgaidot
rgaidot / sinatra-memcacher.rb
Created April 4, 2012 13:52 — forked from mralex/sinatra-memcacher.rb
Simple memcached helper for Sinatra.
# Activate in a modular Sinatra app:
#
# register Sinatra::Memcacher
# set :memcacher_enabled, true
# set :memcacher_expiry, 86400
# Cache an action:
#
# get '/' do
# cache "index" do
@rgaidot
rgaidot / 0_README.md
Created September 15, 2012 01:31 — forked from josevalim/0_README.md
Sinatra like routes in Rails controllers

Sinatra like routes in Rails controllers

A proof of concept of having Sinatra like routes inside your controllers.

How to use

Since the router is gone, feel free to remove config/routes.rb. Then add the file below to lib/action_controller/inline_routes.rb inside your app.

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

#!/bin/bash
# cpustatus
#
# Prints the current state of the CPU like temperature, voltage and speed.
# The temperature is reported in degrees Celsius (C) while
# the CPU speed is calculated in megahertz (MHz).
function convert_to_MHz {
let value=$1/1000
echo "$value"
@rgaidot
rgaidot / post-merge
Created May 25, 2016 20:22 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed. In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed. Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@rgaidot
rgaidot / gitflow-breakdown.md
Created September 12, 2016 16:24 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository