Skip to content

Commit

Permalink
feat: files added
Browse files Browse the repository at this point in the history
  • Loading branch information
hauzerlee authored and nuffin committed May 11, 2024
0 parents commit 3ef1c09
Show file tree
Hide file tree
Showing 56 changed files with 2,498 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.DS_Store
.*.sw?

*.local
*.local.pre
*.local.post

*rc.vars
*rc.aliases
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# RC Files

These are RC (Runtime Config) files for command line environment.

## How to use

Just clone and execute `./deploy.sh'.

You may need to update some settings, by editing `shrc.d/rc.vars` file

### Notice

It will backup your original files if same name, and make symblic link to files/directories in your cloned directory.
4 changes: 4 additions & 0 deletions bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## Personal settings - begin ##
## additional personal runtime config
test -f ~/.bashrc.d/bashrc.${USER} && source ~/.bashrc.d/bashrc.${USER}
## Personal settings - end ##
97 changes: 97 additions & 0 deletions bashrc.d/bashrc.USER
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
test -f ~/.bashrc.d/bashrc.local.pre && source ~/.bashrc.d/bashrc.local.pre
test -f ~/.bashrc.d/bashrc.vars && source ~/.bashrc.d/bashrc.vars

#if test -x /usr/bin/which; then
# WHICH=/usr/bin/which
#elif test -x /bin/which; then
# WHICH=/bin/which
#fi
WHICH="command -v"

############################################################
### add these lines into ~/.bashrc && remove leading '#'
### additional personal runtime config
#test -f ~/.bashrc.${USER} && source ~/.bashrc.${USER}
############################################################

## use "jq" instead
#if test "x$(uname -s)" = "xLinux"; then
# alias jsonpp="python -m json.tool"
#fi

if test "${TERM}" != "linux"; then
parse_git_branch_for_prompt() {
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if test -z "${branch}"; then
return
fi
echo -e "(${branch}) "
}
if test "${DISTRO_NAME}" = "Kali"; then
prompt_color='\[\033[;32m\]'
info_color='\[\033[1;34m\]'
prompt_symbol=㉿
export PS1="$prompt_color┌──${debian_chroot:+($debian_chroot)──}${VIRTUAL_ENV:+(\[\033[0;1m\]$(basename $VIRTUAL_ENV)$prompt_color)}($info_color\u$prompt_symbol\h$prompt_color)-[\[\033[0;1m\]\w$prompt_color]\n$prompt_color└─$info_color\[\e[01;33m\]\$(parse_git_branch_for_prompt)\[\e[00m\]\$\[\033[0m\] "
else
test ! -z "${PS1_USER_HOST_COLOR}" || PS1_USER_HOST_COLOR='01;32'
test ! -z "${PS1_PATH_COLOR}" || PS1_PATH_COLOR='01;36'
test ! -z "${PS1_GIT_BRANCH_COLOR}" || PS1_GIT_BRANCH_COLOR='01;33'
export PS1="\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\e[${PS1_USER_HOST_COLOR}m\]\u@\h\[\e[00m\]:\[\e[${PS1_PATH_COLOR}m\]\w\[\e[00m\]\n\[\e[${PS1_GIT_BRANCH_COLOR}m\]\$(parse_git_branch_for_prompt)\[\e[00m\]\$ "
fi
fi

shopt -s cdspell
shopt -s no_empty_cmd_completion
shopt -s extglob

export HISTCONTROL=ignoredups:erasedups
export HISTFILESIZE=50000000

export EDITOR=vim
export VISUAL=vim

## Virtualenvwrapper
#export WORKON_HOME=${HOME}/.virtualenvs
#if test -z "${VIRTUALENVWRAPPER_PYTHON}"; then
# if test "${OSNAME}" = "Darwin"; then
# export VIRTUALENVWRAPPER_PYTHON=$(${WHICH} python2.7)
# fi
#fi
#if test -z "${VIRTUAL_ENV}"; then
# if ! type workon >/dev/null 2>&1; then
# if test -f /usr/local/bin/virtualenvwrapper.sh; then
# source /usr/local/bin/virtualenvwrapper.sh
# fi
# fi
# if type workon >/dev/null 2>&1; then
# test ! -z "${VIRTUALENV_NAME}" && workon ${VIRTUALENV_NAME}
# fi
#fi

if test ! -z "${BASHRCS}"; then
for f in ${BASHRCS}; do
test -f ${f} && source ${f}
done
fi

export GPG_TTY=$(tty)

if test ! -z "${OTHER_RC_NAMES}"; then
for shrc in ${OTHER_RC_NAMES}; do
if test -e ${HOME}/.bashrc.d/bashrc.${shrc}; then
shrc_path=${HOME}/.bashrc.d/bashrc.${shrc}
elif test -e ${HOME}/.shrc.d/rc.${shrc}; then
shrc_path=${HOME}/.shrc.d/rc.${shrc}
fi
if test -e ${shrc_path}; then
source ${shrc_path}
fi
done
fi

RVM_PROFILE=/etc/profile.d/rvm.sh
test -f ${RVM_PROFILE} && source ${RVM_PROFILE}

test -f ~/.bashrc.d/bashrc.local.post && source ~/.bashrc.d/bashrc.local.post

# vim: set sts=4 sw=4 et ft=sh:
3 changes: 3 additions & 0 deletions bashrc.d/bashrc.colors
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export LS_COLORS='rs=0:di=01;36:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'

# vim: set sts=4 sw=4 et ft=sh:
5 changes: 5 additions & 0 deletions bashrc.d/bashrc.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#echo "enter bashrc.common ..."

test -f ${HOME}/.shrc.d/rc.common && source ${HOME}/.shrc.d/rc.common

# vim: set sts=4 sw=4 et ft=sh:
3 changes: 3 additions & 0 deletions bashrc.d/bashrc.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test -f ${HOME}/.shrc.d/rc.docker && source ${HOME}/.shrc.d/rc.docker

# vim: set ts=8 sts=4 sw=4 et ft=sh:
3 changes: 3 additions & 0 deletions bashrc.d/bashrc.git
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test -f ${HOME}/.shrc.d/rc.git && source ${HOME}/.shrc.d/rc.git

# vim: set sts=4 sw=4 et ft=sh:
3 changes: 3 additions & 0 deletions bashrc.d/bashrc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test -f ${HOME}/.shrc.d/rc.go && source ${HOME}/.shrc.d/rc.go

# vim: set sts=4 sw=4 et ft=sh:
9 changes: 9 additions & 0 deletions bashrc.d/bashrc.k8s
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
for x in /usr/bin/kubectl /usr/local/bin/kubectl; do
if test -x ${x}; then
export KUBECTL=${x}
break
fi
done
alias kubectl="/usr/bin/env HTTP_PROXY= HTTPS_PROXY= ALL_PROXY= http_proxy= https_proxy= all_proxy= NO_PROXY= ${KUBECTL}"

# vim: set sts=4 sw=4 et ft=sh:
5 changes: 5 additions & 0 deletions bashrc.d/bashrc.local.post.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#echo "enter bashrc.local.post ..."

test -f ${HOME}/.shrc.d/rc.local.post && source ${HOME}/.shrc.d/rc.local.post

# vim: set sts=4 sw=4 et ft=sh:
5 changes: 5 additions & 0 deletions bashrc.d/bashrc.local.pre.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#echo "enter bashrc.local.pre ..."

test -f ${HOME}/.shrc.d/rc.local.pre && source ${HOME}/.shrc.d/rc.local.pre

# vim: set sts=4 sw=4 et ft=sh:
5 changes: 5 additions & 0 deletions bashrc.d/bashrc.nvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion

# vim: set sts=4 sw=4 et ft=sh:
40 changes: 40 additions & 0 deletions bashrc.d/bashrc.screens
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
function screens
{
SCREEN=/usr/bin/screen

SCREENS=$@
test -z "${SCREENS}" && test -f ~/.bashrc.d/bashrc.screens && source ~/.bashrc.d/bashrc.screens
test -z "${SCREENS}" && SCREENS="${USER}"

for name in ${SCREENS}; do
running=$(${SCREEN} -ls | grep "tached)" | awk '{print $1}' | cut -d'.' -f2)
found=0
for x in ${running}; do
if test "${name}" == "${x}"; then
echo "${name} exists"
found=1
break
fi
done
if test ${found} == 1; then
continue
fi
echo "creating screen named ${name}"
screenrc=${HOME}/.screenrc.d/screenrc.${name}
if test -f ${screenrc}; then
dirname=$(sed -n "s,^#DIR:\(.*\)$,\1,p" ${screenrc})
if test ! -z "${dirname}" -a -d "${dirname}"; then
cd ${dirname}
${SCREEN} -dmS ${name} -c ${screenrc}
cd ${OLDPWD}
else
${SCREEN} -dmS ${name} -c ${screenrc}
fi
else
echo "WARNING: ${screenrc} not found"
screen -dmS ${name}
fi
done
}

# vim: set sts=4 sw=4 et ft=sh:
11 changes: 11 additions & 0 deletions bashrc.d/bashrc.vars.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#echo "enter bashrc.vars..."

test -f ${HOME}/.shrc.d/rc.vars && source ${HOME}/.shrc.d/rc.vars

#PS1_USER_HOST_COLOR='01;35'
#PS1_PATH_COLOR='01;36'
#PS1_GIT_BRANCH_COLOR='01;33'

OTHER_RC_NAMES="${OTHER_RC_NAMES} screens colors aliases screens.local"

# vim: set sts=4 sw=4 et ft=sh:
103 changes: 103 additions & 0 deletions deploy-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
@'
Installing nvm-windows
'@

@'
download from https://github.com/coreybutler/nvm-windows/releases and then install it
'@


@'
Installing pyenv-win
'@

# Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"
(new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1") | iex


@'
Installing PsGet and posh-git
'@

(new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/psget/psget/master/GetPsGet.ps1") | iex

# $PSVersionTable

Install-Module posh-git -Scope CurrentUser

# $env:PSModulePath
# $env:PSModulePath.split(";")[0]
# # code $PROFILE

Add-PoshGitToProfile
if (!(Test-Path -Path $PROFILE)) {
New-Item -ItemType File -Path $PROFILE -Force
}

@'
Import-Module posh-git
$GitPromptSettings.DefaultPromptAbbreviateHomeDirectory = true
$GitPromptSettings.DefaultPromptWriteStatusFirst = $true
$GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n'
'@ >> $PROFILE

@'
Adding Clone-Git command to PROFILE
'@

@'
function Clone-Git
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[string] $SshKeyFilePath,
[Parameter(Mandatory=$false, Position=0)]
[string] $Url
)
Process
{
if (!$Url) {
Write-Error "Usage: ${0} git@gitserver.com:owner/project.git|https://gitserver.com/owner/project.git"
return
}
$PathItems = $Url -replace '.git$', '' -replace '(.*@|(https|http|ssh)://)([a-z0-9\.-]+)(:[0-9]+/|:|/)(.*)/(.*)', '$3 $5 $6' -split ' '
$Path = [string]::Join('\', $env:USERPROFILE, 'studio', $PathItems[0], $PathItems[1]);
$RepoName = $PathItems[2]
Write-Host "Cloning $Url into $Path/ as $RepoName ..."
New-Item -ItemType Directory $Path -ErrorAction SilentlyContinue
Push-Location $Path
if ($Url -match '^http' || !$SshKeyFilePath) {
git clone $Url
} else {
$SshKeyFilePath = $SshKeyFilePath -replace '^~', $env:USERPROFILE -replace '\\', '/'
# Write-Host $SshKeyFilePath
git clone -c core.sshCommand="ssh -i $SshKeyFilePath" $Url
}
Pop-Location
}
}
'@ >> $PROFILE

#
# ```
# Import-Module posh-git
# $GitPromptSettings.DefaultPromptAbbreviateHomeDirectory = true
# $GitPromptSettings.DefaultPromptWriteStatusFirst = $true
# $GitPromptSettings.DefaultPromptBeforeSuffix.Text = '`n'
# ```
Loading

0 comments on commit 3ef1c09

Please sign in to comment.