Skip to content

Commit db35209

Browse files
committed
Update theme and custom functions
1 parent 3bf989b commit db35209

File tree

2 files changed

+83
-14
lines changed

2 files changed

+83
-14
lines changed

custom/example.zsh

Lines changed: 77 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,44 @@
1212
# cd $brainstormr
1313
#
1414
# brainstormr=/Users/robbyrussell/Projects/development/planetargon/brainstormr
15-
#
1615

1716
autoload edit-command-line
1817
zle -N edit-command-line
1918
bindkey '^Xe' edit-command-line
2019

20+
function ssh-ec2 {
21+
ssh ec2-user@$(aws ec2 describe-instances --filters Name=tag:Name,Values=$1 | jq -r '.Reservations[].Instances[]|select(.State.Code == 16)|.PublicDnsName' | head -1)
22+
}
23+
24+
function pretty-json {
25+
ruby -e "require 'json'; puts (JSON.pretty_generate JSON.parse(STDIN.read))"
26+
}
27+
28+
function get-city() {
29+
if [ $1 = 'Maison-Neuve' ]; then
30+
echo "zmw:00000.27.07570"
31+
else
32+
echo $1
33+
fi
34+
}
35+
36+
function current-temp() {
37+
api_key=$(cat ~/.wunderground)
38+
city=$(get-city $@)
39+
curl -s "http://api.wunderground.com/api/${api_key}/geolookup/conditions/q/FR/${city}.json" | jq -r '.current_observation | .feelslike_string'
40+
}
41+
42+
function hourly-temp() {
43+
api_key=$(cat ~/.wunderground)
44+
city=$(get-city $@)
45+
curl -s "http://api.wunderground.com/api/${api_key}/hourly/q/FR/${city}.json" | jq -r '.hourly_forecast[] | "\(.FCTTIME.hour):\(.FCTTIME.min) - \(.feelslike.metric)C \(.feelslike.english)F"'
46+
}
47+
48+
49+
function now() {
50+
echo $(date "+%Y-%m-%d %H:%M:%S") - "$@" >> ./.now
51+
}
52+
2153
function ssht() {
2254
set_title $@
2355
ssh -t gw ssh -At $@
@@ -103,7 +135,7 @@ function cur() {
103135

104136
function git_author_info() {
105137
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
106-
echo "Current author: $(git config user.name)"
138+
echo "Current author: $(git config user.name) <$(git config user.email)>"
107139
}
108140

109141
function ruby-version-name() {
@@ -117,22 +149,55 @@ function dir_jump() {
117149
git_author_info
118150
}
119151

120-
function r3() {
121-
BUNDLE_GEMFILE=Gemfile.rails3 $@
122-
}
123-
124152
function rmb() {
125153
(git branch -D $@ || test 1) && git push origin :$@
126154
}
127155

156+
function hg() {
157+
history | grep "$@"
158+
}
159+
160+
function _get_workspace_status() {
161+
aws ec2 describe-instances --filters "Name=tag:Name,Values=eirik-workspace"
162+
}
163+
164+
function ws_status() {
165+
full_status=$(_get_workspace_status)
166+
echo $full_status | jq -r '.Reservations[0].Instances[0].State.Name'
167+
}
168+
169+
function _get_status_code() {
170+
full_status=$(_get_workspace_status)
171+
echo $full_status | jq -r '.Reservations[0].Instances[0].State.Code'
172+
}
173+
174+
function ws_login {
175+
status_code=$(_get_status_code)
176+
if [ $status_code -gt 16 ]
177+
then
178+
echo "starting workspace"
179+
aws ec2 start-instances --instance-ids=$(echo $full_status | jq -r '.Reservations[0].Instances[0].InstanceId')
180+
else
181+
ssh $(echo $full_status | jq -r '.Reservations[0].Instances[0].PublicDnsName')
182+
fi
183+
}
184+
185+
function ws_stop {
186+
status_code=$(_get_status_code)
187+
if [ $status_code -eq 16 ]
188+
then
189+
echo "stopping workspace"
190+
aws ec2 stop-instances --instance-ids=$(echo $full_status | jq -r '.Reservations[0].Instances[0].InstanceId')
191+
else
192+
echo $full_status | jq -r '.Reservations[0].Instances[0].State.Name'
193+
fi
194+
}
195+
128196
export BUNDLER_EDITOR='mvim'
129-
export EDITOR='mvim'
197+
export EDITOR='mvim -f'
130198

131-
alias console='open -a Console '
199+
alias dcm='docker-compose'
132200
alias gem_tunnel='ssh -NCf -L 2000:localhost:80 "ubuntu@gems.efficiency20.com"'
133-
alias cuc='cucumber'
134-
alias br='bundle exec rspec'
135-
alias rs='rake spec'
136201
alias gt='git stash'
137202
alias ghco='git-hub-commit $1'
138203
alias glc="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit"
@@ -141,3 +206,4 @@ alias gw='git checkout $1 && git rebase master'
141206
alias fix='git diff --name-only | uniq | xargs $EDITOR'
142207
alias tmux="TERM=screen-256color-bce tmux"
143208
alias gpair='dir_jump /Users/esinclair/github/edsinclair/git-pair'
209+
alias tt='timetrap'

themes/edsinclair.zsh-theme

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%c %{$fg[red]%}‹$RUBY_VERSION› %{$fg_bold[blue]%}$(git_prompt_info) % %{$reset_color%}'
1+
PROMPT='$(timetrap_status) %{$fg_bold[green]%}%p%{$fg[cyan]%}%c %{$fg[red]%}‹$RUBY_VERSION› %{$fg_bold[blue]%}$(git_prompt_info) % %{$reset_color%}'
22
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
33
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
4-
ZSH_THEME_GIT_PROMPT_DIRTY="› ✗%{$reset_color%}"
5-
ZSH_THEME_GIT_PROMPT_CLEAN="›%{$fg[blue]%}"
4+
ZSH_THEME_GIT_PROMPT_DIRTY="› %{$fg[red]%}✗%{$reset_color%}"
5+
ZSH_THEME_GIT_PROMPT_CLEAN="›%{$fg[green]%} ✓"
6+
7+
ZSH_THEME_TIMETRAP_PROMPT_IN="%{$fg[green]%}◉%{$reset_color%}"
8+
ZSH_THEME_TIMETRAP_PROMPT_OUT="%{$fg[red]%}◉%{$reset_color%}"

0 commit comments

Comments
 (0)