Skip to content

Commit

Permalink
🎉 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva committed Apr 13, 2018
0 parents commit 9915933
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .zshrc
@@ -0,0 +1,13 @@
# Global options
export DOTFILES=$HOME/🔥/dotfiles
export ZSH=$HOME/.oh-my-zsh
export EDITOR=subl

# Oh my zsh configurations.
ZSH_THEME="cloud"
ZSH_CUSTOM=$DOTFILES
plugins=()
source $ZSH/oh-my-zsh.sh

# Autojump
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
9 changes: 9 additions & 0 deletions README.md
@@ -0,0 +1,9 @@
# dotfiles
❄️ Personal set of configurations for macOS

1. Git clone wherever
2. Replace your `~/.zshrc` file with
```
# Load Zsh
source $HOME/path/to/dotfiles/.zshrc
```
61 changes: 61 additions & 0 deletions aliases.zsh
@@ -0,0 +1,61 @@
# Configurations
alias zconf="$EDITOR $DOTFILES/.zshrc"
alias zpath="$EDITOR $DOTFILES/path.zsh"
alias zfunc="$EDITOR $DOTFILES/functions.zsh"
alias zalias="$EDITOR $DOTFILES/aliases.zsh"

# Directories
alias fire="cd ~/🔥"
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"

# Laravel, php
alias a="php artisan"
alias cu="composer update"
alias cr="composer require"
alias ci="composer install"
alias cda="composer dump-autoload -o"
alias phpunitc="phpunit --coverage-html build"

# Npm
alias ni="npm install"
alias w="npm run watch"

# Git
alias g="git"
alias gs="git status"
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias nah="git reset --hard && git clean -df"
alias push="git push"
alias pull="git pull --rebase"

# List (basic, all, directories)
alias ll="ls -lh"
alias la="ls -lah"
alias lsd="ls -lh | grep --color=never '^d'"

# Command manipulations
alias copy="tr -d '\n' | pbcopy"
alias copyssh="pbcopy < $HOME/.ssh/id_rsa.pub"
alias shrug="echo '¯\_(ツ)_/¯' | pbcopy"
alias map="xargs -n1"
alias sudo='sudo ' # Enable aliases to be sudo’ed

# Quick functions
alias reload="exec ${SHELL} -l"
alias stfu="osascript -e 'set volume output muted true'"
alias pumpitup="osascript -e 'set volume output volume 80'"
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
alias flushdns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"

# HTTP request helpers
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
alias "${method}"="lwp-request -m '${method}'"
done

# Miscellaneous getters
alias week='date +%V'
alias path='echo -e ${PATH//:/\\n}'
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias iplocal="ifconfig | grep 'inet ' | grep -Fv 127.0.0.1 | awk '{print \$2}'"
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
43 changes: 43 additions & 0 deletions bootstrap.sh
@@ -0,0 +1,43 @@
#!/bin/sh

echo "Setting up your Mac..."

# ------------------------------------------------------------------------------
# Install Brew and its dependencies.
# ------------------------------------------------------------------------------

if test ! $(which brew); then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

brew update
brew tap homebrew/bundle
brew bundle

# ------------------------------------------------------------------------------
# Make ZSH the default shell environment.
# ------------------------------------------------------------------------------

chsh -s $(which zsh)

# ------------------------------------------------------------------------------
# Install Composer and its dependencies.
# ------------------------------------------------------------------------------

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

composer global require laravel/installer laravel/valet
valet install

# ------------------------------------------------------------------------------
# Install global NPM packages.
# ------------------------------------------------------------------------------

npm install --global yarn

# ------------------------------------------------------------------------------
# Create a project directory.
# ------------------------------------------------------------------------------

mkdir -p $HOME/🔥
96 changes: 96 additions & 0 deletions functions.zsh
@@ -0,0 +1,96 @@
#!/usr/bin/env bash

mkd() {
mkdir -p "$@" && cd "$_";
}

commit() {
commitMessage="$1"

if [ "$commitMessage" = "" ]; then
commitMessage=":pencil: Small changes"
fi

git add .
eval "git commit -a -m '${commitMessage}'"
}

archive () {
zip -r "$1".zip -i "$1" ;
}

weather() {
city="$1"

if [ -z "$city" ]; then
city="Alhaurin+el+grande"
fi

eval "curl http://wttr.in/${city}"
}

fs() {
if du -b /dev/null > /dev/null 2>&1; then
local arg=-sbh;
else
local arg=-sh;
fi
if [[ -n "$@" ]]; then
du $arg -- "$@";
else
du $arg .[^.]* ./*;
fi;
}

json() {
if [ -t 0 ]; then # argument
python -mjson.tool <<< "$*" | pygmentize -l javascript;
else # pipe
python -mjson.tool | pygmentize -l javascript;
fi;
}

count() {
if [ -t 0 ]; then # argument
wc -l "$*";
else # pipe
wc -l;
fi;
}

digga() {
dig +nocmd "$1" any +multiline +noall +answer;
}

o() {
if [ $# -eq 0 ]; then
open .;
else
open "$@";
fi;
}

tre() {
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX;
}

emptytrash() {
setopt +o nomatch;
sudo rm -rf /Volumes/*/.Trashes/*;
sudo rm -rf ~/.Trash/*;
sudo rm -rf /private/var/log/asl/*.asl;
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent';
echo 'Whirrrshhhhhhhcccchhh';
}

update() {
sudo softwareupdate -i -a;
brew update;
brew upgrade;
brew cleanup;
npm install npm -g;
npm update -g;
sudo gem update --system;
sudo gem update;
sudo gem cleanup;
}
13 changes: 13 additions & 0 deletions path.zsh
@@ -0,0 +1,13 @@
# Paths ordered by increasing priority.

# Global bin directories
export PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

# Global composer
export PATH="$HOME/.composer/vendor/bin:$PATH"

# VS Code
export PATH="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin:$PATH"

# Local bin directories
export PATH="./bin:./vendor/bin:$PATH"

0 comments on commit 9915933

Please sign in to comment.