Skip to content

Instantly share code, notes, and snippets.

Thu Mar 8 20:42:43 UTC 2018
@dbwest
dbwest / default.nix
Created June 2, 2018 05:23
default.nix for ruby development
let
pkgs = import <nixpkgs> {};
stdenv = pkgs.stdenv;
ruby = pkgs.ruby;
rubygems = (pkgs.rubygems.override { ruby = ruby; });
in stdenv.mkDerivation rec {
name = "cryptocrunch";
buildInputs = [
@dbwest
dbwest / working_bulk_import_data.json
Last active June 24, 2018 21:56
Some bulk import data into Elasticsearch that works
{"index":{"_id":"ab1d0210-2425-4798-8eac-acab1e27e750"}}
{"market":{"id":"russiacoin","name":"RussiaCoin","symbol":"RC","rank":"968","price_usd":"0.985482","price_btc":"0.00010022","24h_volume_usd":"242.863","market_cap_usd":"8256243.0","available_supply":"8377873.0","total_supply":"8377873.0","max_supply":null,"percent_change_1h":"-0.7","percent_change_24h":"-7.66","percent_change_7d":"-21.69","last_updated":"1519311547","internal_id":"russiacoin","cmc_id":"russiacoin","price_eth":0.0012223062878916,"market_percent":1.9306245953689e-5},"topCoinByAllTimeGrowth":0}
@dbwest
dbwest / cant_import.json
Last active June 24, 2018 21:57
JSON I can't import into Elasticsearch
{"index":{"_id":"aa9e82d7-0d17-4216-ba74-e753d16ca9bc"}}
{"market":{"id":"0x","name":"0x","symbol":"ZRX","rank":"47","price_usd":"0.866996","price_btc":"0.00008817","24h_volume_usd":"9319700.0","market_cap_usd":"444241833.0","available_supply":"512392021.0","total_supply":"1000000000","max_supply":null,"percent_change_1h":"-0.07","percent_change_24h":"-11.03","percent_change_7d":"-18.11","last_updated":"1519311553","internal_id":"0x","cmc_id":"0x","price_eth":0.0010753465434953,"market_percent":0.0010388068872023,"first_trade_time":1502892561,"first_price_usd":0.111725,"avg_3mo_volume":20927598.619727,"avg_3mo_mkt_cap":487394441.7039,"growth_all_time":7.8062295815619,"volume_change_24h":-21730,"mkt_cap_percent_change_24h":0.0010344518726417,"mkt_cap_against_total_market_growth":0.048752950800101,"price_change_btc_24h":-3.1220000000001e-7,"price_change_eth_24h":4.0867274234352e-6,"percent_change_1mo":-81.019112516067,"proof_type":"N\/A","algorithm":"N\/A"},"topCoinByAllTimeGrowth":0,"categories":["Exchange","G
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl
@dbwest
dbwest / install_gpu_docker.sh
Last active May 19, 2019 21:13 — forked from im7mortal/install_gpu_docker.sh
Install docker and nvidia-docker
# Disco!
sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual -y
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common -y
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" -y
sudo apt-get update
sudo apt-get install docker.io -y
wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb
sudo dpkg --ignore-depends=docker-ce -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb
@dbwest
dbwest / get_perms.sh
Created June 20, 2019 17:56
get permissions for es log dirs 2 deep
ansible --ask-become-pass -b -i hosts all -m shell -a "tree -pufidg -L 2 /data"
@dbwest
dbwest / get_es_ymls.sh
Created June 20, 2019 17:57
print out all the es yamls in your cluster
ansible --ask-become-pass -b -i hosts all -m shell -a "cat /etc/elasticsearch/elasticsearch.yml"
@dbwest
dbwest / cluster_health.yml
Created June 20, 2019 17:58
get es cluster health
ansible -i hosts all -m shell -a "curl http://127.0.0.1:9200/_cluster/health?pretty"
@dbwest
dbwest / hosts
Created June 20, 2019 17:58
example hosts file to use with es scripts
[es]
eshostname1
eshostname2
eshostname3