Skip to content

Instantly share code, notes, and snippets.

@rbf
rbf / README.md
Last active August 29, 2015 14:18
Get a list of the most played artists in La Planete Bleue radio show. Clojure version of https://gist.github.com/st/0c8512f916b944a3a23d.

Assuming you are on a *nix system with lein installed, you can run this gist with following command on a clean directory:

curl -sSLOO https://gist.github.com/rbf/dccd50e7bcfce45ba5a3/raw/{project,core}.clj && mkdir src && mv core.clj src/ && time lein run

This command will download both files below and begin the parsing of all broadcasted shows to finally list the 10 most played artitst. Please allow some 1.5-ish minutes to run, since there are more than 850 shows to date.

@rbf
rbf / gist:3181725
Created July 26, 2012 12:19
Get leiningen
# Following instruction from http://leiningen.org/
# Download the 2.x preview release, which is recommended as of 26jul2012, to your $PATH (here using /usr/local/bin)
sudo curl -L -o '/usr/local/bin/lein' 'https://raw.github.com/technomancy/leiningen/preview/bin/lein'
# For the 1.x stable release run instead:
sudo curl -L -o '/usr/local/bin/lein' 'https://raw.github.com/technomancy/leiningen/stable/bin/lein'
# Set it to be executable
sudo chmod a+x /usr/local/bin/lein
@rbf
rbf / install-cassandra.sh
Created October 9, 2012 14:58
Install Cassandra
#!/bin/bash
# Run this script directly with:
# bash <(curl -sSL https://raw.github.com/gist/3859355/install-cassandra.sh)
CASSANDRA_FILE_NAME="apache-cassandra"
CASSANDRA_VERSION="${1:-1.1.5}" # By default install 1.1.5, the last stable release as of 09oct2012
CASSANDRA_DIR=$CASSANDRA_FILE_NAME-$CASSANDRA_VERSION
CASSANDRA_TARBALL_NAME=$CASSANDRA_DIR-bin.tar.gz
@rbf
rbf / install-opscenter.sh
Created October 11, 2012 12:58
Install OpsCenter from DataStax
#!/bin/bash
# Run this script directly with:
# bash <(curl -sSL https://raw.github.com/gist/3872107/install-opscenter.sh)
OPSCENTER_NAME="opscenter"
OPSCENTER_TARBALL_NAME="$OPSCENTER_NAME.tar.gz"
echo
echo "Installing OpsCenter (last stable version)"
@rbf
rbf / install_mongodb_on_ubuntu.sh
Last active October 11, 2015 16:12
Executable version of the guide posted on the official MongoDB page (http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/) to install it on Ubuntu 14.04.
#!/bin/bash
# Install MongoDB on Ubuntu 14.04
# Executable version of the guide posted on the official MongoDB page:
# SOURCE: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
# On a c9.io ubuntu machine, refer instead to the support document "Setting Up MongoDB · Cloud9"
# SOURCE: https://docs.c9.io/docs/setting-up-mongodb
@rbf
rbf / install-subl-config.sh
Created July 22, 2013 14:55
Capture config for Sublime Text 2 into Dropbox, or install it to the current user if already captured.
#!/bin/sh
# The MIT License (MIT)
#
# Copyright (c) 2013 https://gist.github.com/rbf
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
@rbf
rbf / README.md
Last active December 20, 2015 09:58
One-liner to obtain the public ssh key, creating it in the way if not present.
@rbf
rbf / README.md
Last active December 20, 2015 10:48
Shell tool to get the permalink of a gist raw file at given commit or tag at https://gist.github.com.

Description

Shell tool to get the permalink of a gist raw file at given commit or tag at https://gist.github.com.

Installation

To install this tool (v2.0) directly to your /usr/local/bin you can use following command (you might need to be root to execute it):

@rbf
rbf / echoarraywithmaxwidth
Last active December 21, 2015 00:18
List bash array with max line length and custom item separator.
# Usage: echoarraywithmaxwidth <max line length> <array name> [<item separator>] [<line prefix>]
echoarraywithmaxwidth(){
declare -i ea_line_length
ea_separator="${3:-", "}"
ea_result=""
ea_array=()
for (( i = 0; i < "$(eval echo \"\${#${2}[@]}\")"; i++ )); do
ea_array+=("$(eval echo \"\${${2}[${i}]}\")")
done
@rbf
rbf / generate_random_text
Created August 14, 2013 09:37
Generate random text in bash
#!/bin/bash
declare -i NUMBER_OF_WORDS=300
WORD_LIST=("Sed" "ut" "perspiciatis" "unde" "omnis" "iste" "natus" "error" "sit" "voluptatem" "accusantium" \
"doloremque" "laudantium," "totam" "rem" "aperiam," "eaque" "ipsa" "quae" "ab" "illo" "inventore" \
"veritatis" "et" "quasi" "architecto" "beatae" "vitae" "dicta" "sunt" "explicabo." "Nemo" "enim" \
"ipsam" "voluptatem" "quia" "voluptas" "sit" "aspernatur" "aut" "odit" "aut" "fugit," "sed" "quia" \
"consequuntur" "magni" "dolores" "eos" "qui" "ratione" "voluptatem" "sequi" "nesciunt." "Neque" \
"porro" "quisquam" "est," "qui" "dolorem" "ipsum" "quia" "dolor" "sit" "amet," "consectetur," \