Skip to content

Instantly share code, notes, and snippets.

@quarbby
quarbby / mongod.sh
Created February 4, 2017 02:44
Script to install mongodb on Cloud9 Workspace
sudo apt-get install -y mongodb-org
mkdir data
echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$@"' > mongod
chmod a+x mongod
./mongod
@quarbby
quarbby / find_nearest_float.py
Created June 28, 2016 08:55
Python find nearest float
import numpy as np
def find_nearest(array,value):
idx = (np.abs(array-value)).argmin()
return array[idx]
array = np.random.random(10)
print(array)
# [ 0.21069679 0.61290182 0.63425412 0.84635244 0.91599191 0.00213826
# 0.17104965 0.56874386 0.57319379 0.28719469]
@quarbby
quarbby / countries.json
Last active December 2, 2022 19:35
JSON compilation of countries with timezone offset from UTC and Lat-Long data
// Json file of the countries of the world
// Fields:
// - name: name of country, String
// - timezone_offset: offset from UTC time, float
// - latlong: latitude and longtitude (N, E), String
// **************************************************************************************************************
// NOTE: REMOVE THESE COMMENTS BEFORE USING THIS FILE OTHERWISE IT IS NOT A VALID JSON FILE
// **************************************************************************************************************
{"countries":[
@quarbby
quarbby / colourful_phrases.md
Last active October 3, 2015 00:03
Just adding some rhythm into colours

You take the name of a colour. Then you string colour names into a phrase. Each line is a phrase. Then you create a badge from http://shields.io where the right side is the colour of the colour.

Really, these are totally cool colour names. Most of them are Crayola colour names, some are Paint names, and some from Bored Panda.

1 2

4 3

5 6 7

@quarbby
quarbby / install.sh
Last active September 30, 2015 03:23
Installing Numerical Computing Stack on Compute Cluster. Includes Numpy, SciPy, Pandas, Matplotlib, Sklearn
#!/usr/bin/sh
# Recommended to run this as sudo
mkdir setup
cd setup
echo 'Installing Numpy.....'
wget http://nchc.dl.sourceforge.net/project/numpy/NumPy/1.9.2/numpy-1.9.2.tar.gz
tar -zxvf numpy-1.9.2.tar.gz