Skip to content

Instantly share code, notes, and snippets.

Avatar

Alvaro Muir alvaromuir

View GitHub Profile
View pretzo_theme_previews.sh
for i in $(prompt -l | sed '1d' | sed 's/ /\n/g')
do
echo $i:
echo $(prompt -p $i) "\n\n"
done
@alvaromuir
alvaromuir / tensorflow_gpu_macos.txt
Created Dec 13, 2017
TensorFlow GPU 1.2+ on MacOS Sierra
View tensorflow_gpu_macos.txt
# Xcode 8, cudnn 6.1, cuda 8.0,
# bazel 0.5.4, tensorflow r1.3
# takes about 36 min on macbook pro 2.8Ghz, 8GB RAM
# edit *tensorflow/third_party/gpus/cuda/BUILD.tpl*
# [#comment out] linkopts = [“-lgomp”]
$ export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/extras/CUPTI/lib
$ export LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH\nexport PATH=$DYLD_LIBRARY_PATH:$PATH \
export flags="--config=cuda --config=opt"
$ export CUDA_HOME=/usr/local/cuda
@alvaromuir
alvaromuir / connstat
Created Jan 28, 2017
Get connection status of supplied domain
View connstat
netstat -nat | grep `nslookup {DOMAIN} | awk '/Address/ ' | sed 's/^.*Address: //p' | tail -1` | awk '{print $6}' | sort | uniq -c | sort -n
View economet
#!/bin/python3
"""
returns possible combinatations in a list
"""
def combo(n,k):
import itertools
return list(itertools.combinations(list(range((n-(n-1)),(n+1))),k))
@alvaromuir
alvaromuir / rPackages.r
Last active Jan 15, 2016
R Setup packages
View rPackages.r
# $ brew install unixodbc on mac
install.packages("devtools")
devtools::install_github("selva86/InformationValue")
install.packages(c("RODBC","RPostgreSQL","RSQLite","RMySQL",
"xlsx","XLConnect","foreign",
"dplyr","tidyr","stringr","lubridate","reshape",
"ggplot2","ggvis","rgl","htmlwidgets","googleVis","RColorBrewer",
View .profile
PS1="\n\u@\h: \[\e[1;36m\]\w\n\[\e[1;32m\]=> \[\e[0m\]"
alias ls='ls -G'
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
export DOCKER_HOST=tcp://192.168.59.103:2376
@alvaromuir
alvaromuir / hdfs-yarn-spark
Last active Aug 29, 2015
Ambari 1.7.0 blueprint for a dockerized cluster build
View hdfs-yarn-spark
{
"configurations": [
{
"nagios-env": {
"nagios_contact": "alvaromuir@gmail.com"
}
}
],
"host_groups": [
{
@alvaromuir
alvaromuir / prep_dfa_import.sh
Last active Aug 29, 2015
Script to prep a downloaded DFA file for hadoop import
View prep_dfa_import.sh
#!/bin/bash
# Script to prep a downloaded dfa file for transfer and ETL to warehouse
# or Hadoop cluster
# takes a sample via subsample for python
# https://pypi.python.org/pypi/subsample/0.0.6
# and gzips for export
#
# ex:
# $ ./prep_dfa_import.sh <1234_downladed_dfa.csv> <new_file.csv> <sample.csv>
# @alvaromuir, 04.19.2015
@alvaromuir
alvaromuir / ssh-auth
Last active Aug 29, 2015
BASH script that automates paswordless ssh.
View ssh-auth
#!/bin/bash
# Script to create passwordless ssh on remote machine from current host
# requires ssh, naturally
# example usage: ssh-auth foreign.host.com id_dsa.pub myUserName
# @alvaromuir, 6.19.15
set -e
USAGECMD="Usage: $0 <hostname> <public-key.pub> [opt: username]"
SSHHOME=~/.ssh/
if [ "$3" ]
@alvaromuir
alvaromuir / clean_headers.py
Last active Aug 29, 2015
Takes an inputted file and returns db friendly string of comma separated fields.
View clean_headers.py
#!/usr/bin/python
# This script takes a 'fields' row from a Google DFA report file
# and makes it db import friendly for all of ya big data needs
# @alvaromuir, updated: 11/2014
import sys
if(len(sys.argv) < 2):
print
print "Error - Requires an input file"