Skip to content

Instantly share code, notes, and snippets.

@nitrocode
Last active August 14, 2020 21:47
Show Gist options
  • Save nitrocode/cc55991a8938a10a8fd8 to your computer and use it in GitHub Desktop.
Save nitrocode/cc55991a8938a10a8fd8 to your computer and use it in GitHub Desktop.
Cygwin ultimate package installer
#!/bin/bash
# install apt-cyg fork
lynx -source https://raw.githubusercontent.com/kou1okada/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin
# update
apt-cyg update
# install everything
apt-cyg install \
zsh \
wget curl lynx \
tar bzip2 unzip zip \
gawk \
git \
vim nano \
openssh \
inetutils \
procps \
net-snmp-utils \
nc \
gcc-core gcc-g++ make binutils
# if you want the MySQL-python pip package
# apt-cyg install libmysqlclient-devel
# copy gawk to awk
cp /usr/bin/gawk /usr/bin/awk
# install sshpass from source
wget http://tcpdiag.dl.sourceforge.net/project/sshpass/sshpass/1.05/sshpass-1.05.tar.gz
tar xvfz sshpass-1.0.5.tar.gz
cd sshpass-1.0.5
./configure
make
make install
cd ../
rm -r sshpass*
cp /usr/local/bin/sshpass.exe /usr/bin/
# config cygwin vim to be more like regular vim, source from stackoverflow
vimconfig="set nocompatible
set backspace=indent,eol,start
set backup
set history=50
set ruler
set background=dark
set showcmd
set incsearch
syntax on
set hlsearch
set bs=2"
echo -e "$vimconfig" > ~/.vimrc
# todo configure ssh
# ssh-host-config
# or
# source: http://withjames.co.uk/?p=354
# (untested) /bin/ssh-host-config -y -c ntsec -u sshd_account -w mypassword
# netsh advfirewall firewall add rule name=SSH dir=in action=allow protocol=tcp localport=22
# net start sshd
# create ~/.bashrc_aliases
# This is now in its own separate gist
echo "source ~/.bashrc_aliases" >> ~/.bashrc
read -r -d '' aliasconfig << EOM
# ls aliases
alias ls="ls -F --group-directories-first --color=auto"
alias ll="ls -l"
# grep aliases
alias grep="grep --color=auto"
alias egrep="egrep --color=auto"
alias fgrep="fgrep --color=auto"
# misc
alias vi="vim"
EOM
echo -e "$aliasconfig" >> ~/.bashrc_aliases
# configure ~/.bashrc
## configure the bash prompt
theip=$(ipconfig | grep IPv4 | awk '{ print $NF }')
read -r -d '' bashconfig << EOM
PS1="[\D{%F %T} \u@$theip \h \w]\n$ "
EOM
echo -e "$bashconfig" >> ~/.bashrc
# install ohmyzsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# default to zsh shell
chsh -s /bin/zsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment