Skip to content

Instantly share code, notes, and snippets.

Locate a program file in the user's path

Sometimes it could be useful to know which program are we using (in the case we have different versions installed). The programs are used depending on their directory and how is that directory added in the PATH.

For example, if we have two different versions of git, one from Apple and other installed with brew. We can know which one we're using by calling:

git --version
  git version 1.9.5 (Apple Git-50.3)
which git
  /usr/bin/git
@dsaiztc
dsaiztc / development.md
Last active August 29, 2015 14:24
Development Environment OS X.

Some configurations about Development Environment on OS X

Homebrew

Install

The missing package manager for OS X.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

It's necessary have installed the Command Line Tools.

Sublime Text CLI

Sublime Text has a CLI called subl. We need to add this to the PATH to be able to use it. To to this, we can add a symbolic link to /usr/local/bin typing:

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/bin/subl

Or in my case I've changed the name to simply sublime:

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/bin/sublime
@dsaiztc
dsaiztc / bash.md
Last active August 29, 2015 14:24
Re-launch Bash Shell.

Re-launch Bash Shell

source ~/.bash_profile

or alternatively

. ~/.bash_profile

Configure tooling

Configure user information for all local repositories.

  • git config --global user.name "[name]" Sets the name you want atached to your commit transactions
  • git config --global user.email "[email address]" Sets the email you want atached to your commit transactions
  • git config --global color.ui auto Enables helpful colorization of command line output
  • git commit --author="Name <email>" -m "whatever"

Create repositories

@dsaiztc
dsaiztc / r.md
Last active August 29, 2015 14:25
Installing R and RStudio with Homebrew.

Install R:

brew install homebrew/science/r

Install RStudio:

brew install Caskroom/cask/rstudio
@dsaiztc
dsaiztc / R.md
Last active November 26, 2019 00:01
R Cheatsheet.

R Cheatsheet

General

  • getwd() Get Working Directory
  • setwd('~/Downloads') Set Working Directory
  • ls() List variables on Environment
  • dir() List directories on Working Directory
  • list.files() List files on Working Directory
  • rm('variable1') Remove variable1 from Environment
  • rm(list = ls())Remove all variables on Environment
  • identical(data1, data2)
@dsaiztc
dsaiztc / RColorBrewer.r
Last active January 22, 2017 14:44
R ggplot2 library
install.packages('RColorBrewer')
library(RColorBrewer)
ggplot(aes(x = carat, y = price, color = clarity), data = diamonds) +
geom_point(alpha = 0.5, size = 1, position = 'jitter') +
scale_color_brewer(
type = 'div',
guide = guide_legend(
title = 'Clarity',
reverse = T,
@dsaiztc
dsaiztc / dates.R
Last active January 19, 2017 15:18
Dates in R.
# http://www.r-bloggers.com/date-formats-in-r/
# Importing Dates from Character Format
dates <- c("05/27/84", "07/07/05")
betterDates <- as.Date(dates, format = "%m/%d/%y")
dates <- c("May 27 1984", "July 7 2005")
betterDates <- as.Date(dates, format = "%B %d %Y")
> betterDates
@dsaiztc
dsaiztc / tidyr_dplyr.R
Last active January 19, 2017 15:18
Wrangling. Tidyr & Dplyr.
# Pipe command
library(magrittr)
# Library Dplyr
library(dplyr)
# Conditional means
pf.fc_by_age <- pf %>%
group_by(age) %>%
summarise(friend_count_mean = mean(friend_count),