Skip to content

Instantly share code, notes, and snippets.

View tonicebrian's full-sized avatar

Toni Cebrián tonicebrian

View GitHub Profile
❯ stack install shakespeare 2&> /tmp/aux.txt
sydtest.cabal is up-to-date
sydtest-aeson.cabal is up-to-date
sydtest-amqp.cabal is up-to-date
sydtest-autodocodec.cabal is up-to-date
@tonicebrian
tonicebrian / orphan-branches.sh
Created January 21, 2020 08:27
Find who created the last commit in unattended remote branches
#!/bin/bash
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci\t%cr\t%cN" $branch | head -n 1` \\t$branch; done | sort -r
@tonicebrian
tonicebrian / gist:fcdf1228e31735c12c6ffc9c978a522f
Created September 17, 2019 07:30
Check for variables defined in bash script
for var in MY_ENV_VAR_1 MY_ENV_VAR_2; do
if [[ -z "${!var:-}" ]];
then
echo "You need to provide a value for env variable $var"
exit 1
fi
done
CREATE INDEX ON :Block(height);
CREATE INDEX ON :Transaction(hash);
CREATE INDEX ON :Output(tx_hash, output_index);
CREATE INDEX ON :Address(address_string);
LOAD CSV WITH HEADERS FROM "http://storage.googleapis.com/bitcoin-neo4j-etl/blocks.csv" AS row
MERGE (b:Block {height: toInt(row.number)})
ON CREATE SET
b.hash = row.hash,
b.size = toInt(row.size),

Keybase proof

I hereby claim:

  • I am tonicebrian on github.
  • I am tonicebrian (https://keybase.io/tonicebrian) on keybase.
  • I have a public key ASCRxHtGVkzN4Jafqr5R2uv0u5SniW01xVznq_VF-kidkgo

To claim this, I am signing this object:

@tonicebrian
tonicebrian / tunnel.py
Created December 15, 2015 13:09
Paramiko tunnel
# Create a SSH connection
import paramiko
import os
ssh = paramiko.SSHClient()
ssh._policy = paramiko.WarningPolicy()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_config = paramiko.SSHConfig()
user_config_file = os.path.expanduser("~/.ssh/config")
@tonicebrian
tonicebrian / GBT_CaliforniaHousing.py
Created November 5, 2012 16:22
Gradient Boosting Trees using Python
# =============
# Introduction
# =============
# I've been doing some data mining lately and specially looking into `Gradient
# Boosting Trees <http://en.wikipedia.org/wiki/Gradient_boosting>`_ since it is
# claimed that this is one of the techniques with best performance out of the
# box. In order to have a better understanding of the technique I've reproduced
# the example of section *10.14.1 California Housing* in the book `The Elements of Statistical Learning <http://www-stat.stanford.edu/~tibs/ElemStatLearn/>`_.
# Each point of this dataset represents the house value of a property with some
# attributes of that house. You can get the data and the description of those