Skip to content

Instantly share code, notes, and snippets.

View alvaromuir's full-sized avatar

Álvaro Muir alvaromuir

View GitHub Profile
@alvaromuir
alvaromuir / install_all_nerdfonts_via_homebrew.sh
Created November 12, 2022 19:56
Installas ALL nerdfonts via Homebrew on MacOS
#!/bin/sh
# Nerd Fonts for your IDE
# https://www.nerdfonts.com/font-downloads
brew tap homebrew/cask-fonts
brew install --cask font-3270-nerd-font font-fira-mono-nerd-font font-inconsolata-go-nerd-font font-inconsolata-lgc-nerd-font \
font-inconsolata-nerd-font font-monofur-nerd-font font-overpass-nerd-font font-ubuntu-mono-nerd-font font-agave-nerd-font \
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 December 13, 2017 11:58
TensorFlow GPU 1.2+ on MacOS Sierra
# 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 January 28, 2017 23:38
Get connection status of supplied domain
netstat -nat | grep `nslookup {DOMAIN} | awk '/Address/ ' | sed 's/^.*Address: //p' | tail -1` | awk '{print $6}' | sort | uniq -c | sort -n
#!/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 January 15, 2016 01:49
R Setup packages
# $ 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",
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 August 29, 2015 14:14
Ambari 1.7.0 blueprint for a dockerized cluster build
{
"configurations": [
{
"nagios-env": {
"nagios_contact": "[email protected]"
}
}
],
"host_groups": [
{
@alvaromuir
alvaromuir / prep_dfa_import.sh
Last active August 29, 2015 14:12
Script to prep a downloaded DFA file for hadoop import
#!/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 August 29, 2015 14:12
BASH script that automates paswordless ssh.
#!/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" ]