Skip to content

Commit

Permalink
Merge pull request #6 from jldeen/wsl-dev
Browse files Browse the repository at this point in the history
Wsl dev branch merge to master wsl
  • Loading branch information
jldeen authored Mar 2, 2018
2 parents bb852e8 + 98195be commit a767f6c
Show file tree
Hide file tree
Showing 16 changed files with 319 additions and 83 deletions.
9 changes: 5 additions & 4 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ brew 'grc'
brew 'imagemagick'
brew 'jp2a'
brew 'jq'
brew 'libcaca', args: ['with-imlib2']
brew 'libgit2'
brew 'openssl'
brew 'node'
brew 'readline'
brew 'postgresql'
brew 'puma/puma/puma-dev'
brew 'python'
brew 'ruby-build'
brew 'rbenv'
brew 'roundup'
brew 'shpotify'
brew 'spaceman-diff'
brew 'spark'
brew 'speedtest-cli'
brew 'tmux'
brew 'unrar'
brew 'wget'
brew 'yarn'
Expand All @@ -31,13 +34,11 @@ cask '1password'
cask 'adium'
cask 'atom'
cask 'firefox'
cask 'garmin-express'
cask 'google-chrome'
cask 'handbrake'
cask 'mapbox-studio'
cask 'seashore'
cask 'slack'
cask 'steam'
cask 'spotify'
cask 'transmission'
cask 'tunnelbear'
cask 'vlc'
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# jldeen does dotfiles - forked from holman's repo

### WSL Configuration
### WSL Configuration / Install
Run the following to configure WSL from scratch...
```
bash -c "$(curl -fsSL https://raw.githubusercontent.com/jldeen/dotfiles/wsl/configure.sh)"
```
### WSL Emulator Install
Run the following command from an Administrator PowerShell prompt...
```
Set-ExecutionPolicy Bypass; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/jldeen/dotfiles/wsl/wslterm.ps1'))
Set-ExecutionPolicy Bypass; irm 'https://raw.githubusercontent.com/jldeen/dotfiles/wsl/wslterm.ps1' | iex;
```

### Notes
Expand Down Expand Up @@ -58,10 +58,10 @@ There's a few special files in the hierarchy.
but still keep those autoloaded files in your home directory. These get
symlinked in when you run `script/bootstrap`.

## install
There are two branches here: WSL and MacOS (still in development).
## Git clone
There are two "master" branches here: WSL and MacOS.

Run this:
If you wish to clone these filesa and run scripts manually, run this:

```sh
git clone https://github.com/jldeen/dotfiles.git ~/.dotfiles
Expand Down
Binary file added Source Code Pro Nerd Font Complete Mono.ttf
Binary file not shown.
3 changes: 2 additions & 1 deletion bash/bashrc.symlink
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@ GIT_PS1_SHOWUPSTREAM="auto"

export PATH=$PATH:/home/jldeen/bin

source '/home/jldeen/lib/azure-cli/az.completion'
# az cli
# source /usr/bin/az
2 changes: 0 additions & 2 deletions bin/az

This file was deleted.

50 changes: 33 additions & 17 deletions bin/internet_info.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,47 @@
#!/bin/bash

#IP=$(ipconfig getifaddr wifi0)
# Internal IP
IP=$(hostname -I | awk {'print $1}')

# # Public IP
PUB_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
# Packet loss check
timeout 7s ping -c 5 google.com | grep 'loss' | awk '{print $6}' > /dev/null 2>&1
if [[ $? -eq 0 ]]
then
PL=$(ping -c 5 google.com | grep 'loss' | awk '{print $6}')
PL+=" p/l"
else
PL=""
fi

# Speedtest
DL=$(speedtest-cli --simple | awk 'NR==2{print $2}')
UP=$(speedtest-cli --simple | awk 'NR==3{print $2}')

# Public IP
PUB_IP=$(speedtest-cli --json | jq -r .client.ip)

if [[ "$PUB_IP" = ";; connection timed out; no servers could be reached" ]]; then
PUB_IP="Not Available"
elif [[ "$PUB_IP" = "" ]]; then
PUB_IP="No external access"
else
PUB_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
PUB_IP=$(speedtest-cli --json | jq -r .client.ip)
fi

INTERNET=''

if [[ $internet_info -lt 20 ]]; then
echo -n '#[fg=colour150]'
elif [[ $internet_info -lt 30 ]]; then
echo -n '#[fg=colour155]'
elif [[ $internet_info -lt 40 ]]; then
echo -n '#[fg=colour160]'
elif [[ $internet_info -lt 50 ]]; then
echo -n '#[fg=colour163]'
else
echo -n '#[fg=colour150]'
fi
#internet_info=`iwconfig eth0 | grep "Signal level" | awk '{print $2}' | sed 's/-//g'`

# if [[ $internet_info -lt 20 ]]; then
# echo -n '#[fg=colour150]'
# elif [[ $internet_info -lt 30 ]]; then
# echo -n '#[fg=colour155]'
# elif [[ $internet_info -lt 40 ]]; then
# echo -n '#[fg=colour160]'
# elif [[ $internet_info -lt 50 ]]; then
# echo -n '#[fg=colour163]'
# else
# echo -n '#[fg=colour150]'
# fi

echo -n "#[fg=colour60]$INTERNET #[fg=colour60]$IP | $PUB_IP"
echo -n "#[fg=colour150]$INTERNET #[fg=colour81]$PL #[fg=colour86]$DL Mbit/s $UP Mbit/s #[fg=colour197]$IP | $PUB_IP"
55 changes: 55 additions & 0 deletions code/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
// word wrap settings
"editor.wordWrap": "on",
//-------- Remote VSCode configuration --------

// Port number to use for connection.
"remote.port": 52698,

// Launch the server on start up.
"remote.onstartup": true,

// Controls the font family.
"editor.fontFamily": "'SourceCodePro Nerd Font Mono'",
"terminal.integrated.fontFamily": "'SourceCodePro Nerd Font Mono'",
"terminal.integrated.fontSize": 11,
"workbench.startupEditor": "newUntitledFile",
"typescript.check.npmIsInstalled": false,
"window.zoomLevel": 1,
"git.autofetch": true,
// "workbench.colorTheme": "Visual Studio Dark"
// "window.zoomLevel": 0,
// "workbench.startupEditor": "newUntitledFile",
//PowerShell
// "terminal.integrated.shell.osx": "/usr/local/bin/powershell",
// Color Override for terminal
"workbench.colorCustomizations": {
"terminal.foreground": "#839496",
"terminal.background": "#002833",
"terminal.ansiBlack": "#003541",
"terminal.ansiBlue": "#268bd2",
"terminal.ansiCyan": "#2aa198",
"terminal.ansiGreen": "#859901",
"terminal.ansiMagenta": "#d33682",
"terminal.ansiRed": "#dc322f",
"terminal.ansiWhite": "#eee8d5",
"terminal.ansiYellow": "#b58901",
"terminal.ansiBrightBlack": "#586e75",
"terminal.ansiBrightBlue": "#839496",
"terminal.ansiBrightCyan": "#93a1a1",
"terminal.ansiBrightGreen": "#586e75",
"terminal.ansiBrightMagenta": "#6c6ec6",
"terminal.ansiBrightRed": "#cb4b16",
"terminal.ansiBrightWhite": "#fdf6e3",
"terminal.ansiBrightYellow": "#657b83",
"terminalCursor.foreground": "#839496",
"terminalCursor.background": "#003541"
},
"workbench.colorTheme": "Visual Studio Dark",
"azure.resourceFilter": [
"72f988bf-86f1-41af-91ab-2d7cd011db47/dfb5d696-98d8-447c-a14d-56f131f3c4a5",
"72f988bf-86f1-41af-91ab-2d7cd011db47/998e0f50-cedb-4e50-a461-52ef20a0478b"
],
"workbench.activityBar.visible": true,
"workbench.sideBar.location": "left"
}
32 changes: 23 additions & 9 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ echo "Now installing Midnight commander..."
echo ''
sudo apt-get install mc -y

# Speedtest-cli, pip and jq install
echo ''
echo "Now installing Speedtest-cli, pip, tmux and jq..."
echo ''
sudo apt-get install jq tmux python-pip -y
sudo pip install --upgrade pip
sudo pip install speedtest-cli

# Bash color scheme
echo ''
echo "Now installing solarized dark WSL color scheme..."
Expand All @@ -95,7 +103,7 @@ then
echo ''
cd $HOME/.dotfiles && echo "switched to .dotfiles dir..."
echo ''
echo "Checking out WSL branch..." && git checkout wsl
echo "Checking out wsl branch..." && git checkout wsl
echo ''
echo "Now configuring symlinks..." && $HOME/.dotfiles/script/bootstrap
if [[ $? -eq 0 ]]
Expand Down Expand Up @@ -125,18 +133,23 @@ echo ''
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Now installing az cli..."
sudo apt-get install python libssl-dev libffi-dev python-dev build-essential -y
curl -L https://aka.ms/InstallAzureCli | bash
exec -l $SHELL
AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list

sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 52E16F86FEE04B979B07E28DB02C46DF417A0893
sudo apt-get install apt-transport-https
sudo apt-get update && sudo apt-get install azure-cli

if [[ $? -eq 0 ]]
then
echo "Successfully installed Azure CLI 2.0."
else
echo "Azure CLI not installed successfully." >&2
fi
else
fi
else
echo "You chose not to install Azure CLI. Exiting now."
fi
fi

# Set default shell to zsh
echo ''
Expand All @@ -145,7 +158,7 @@ echo ''
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Now setting default shell..."
chsh -s $(which zsh); exit 0
chsh -s $(which zsh)
if [[ $? -eq 0 ]]
then
echo "Successfully set your default shell to zsh..."
Expand All @@ -155,5 +168,6 @@ fi
else
echo "You chose not to set your default shell to zsh. Exiting now..."
fi

echo ''
echo ' Badass WSL terminal installed!'
echo ' Badass WSL terminal installed! Please reboot your computer for changes to be made.'
25 changes: 24 additions & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,31 @@ fi
# symlink .dotfiles bin to ~
ln -s $HOME/.dotfiles/bin $HOME/bin

# symlink .dotfiles tmux to ~
# # symlink .dotfiles tmux to ~ & plugin mgr install
ln -s $HOME/.dotfiles/tmux $HOME/.tmux
# Tmux Plugin Manager
echo ''
echo "Now installing tmux plugin manager..."
echo ''
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm


# install Source Code Pro nerd font on Linux systems (not wsl) and configure terminal
# https://github.com/yktoo/yktools/blob/master/gnome-terminal-profile
if [ ! -e /mnt/c/Users ]
then
sudo cp $HOME/.dotfiles/Source\ Code\ Pro\ Nerd\ Font\ Complete\ Mono.ttf /usr/local/share/fonts
sudo chown root /usr/local/share/fonts/Source\ Code\ Pro\ Nerd\ Font\ Complete\ Mono.ttf
sudo fc-cache -fv
$HOME/.dotfiles/terminal/gnome-terminal-profile import $HOME/.dotfiles/terminal/terminal.gnome && echo "terminal profile loaded successfully!"
# symlink VSCode User Settings
if [ -e $HOME/.config/Code/User ]
then
ln -s $HOME/.dotfiles/code/settings.json $HOME/.config/Code/User/settings.json && echo "VS Code settings.json applied successfully!"
else
echo "No installation of VS Code found. Will not attempt to symlink VS Code settings.json."
fi
fi

echo ''
echo ' All installed!'
53 changes: 53 additions & 0 deletions terminal/gnome-terminal-profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
#=======================================================================================================================
# Export and import Gnome Terminal profiles
# https://github.com/yktoo/yktools/blob/master/gnome-terminal-profile
#=======================================================================================================================

# Displays usage info and exits
# Parameters:
# 1 - error message (if any)
usage() {
[ -z "$1" ] || echo "ERROR: $1" >&2
echo "Usage: $0 import|export <filename>" >&2
exit 1
}

# Prints a failure message and exits
# Parameters:
# 1 - message
err() {
echo "ERROR: $1" >&2
exit 2
}

#-----------------------------------------------------------------------------------------------------------------------

# Check variables
mode="$1"
filename="$2"
[[ -z "$mode" ]] && usage "No mode specified"
[[ -z "$filename" ]] && usage "No filename specified"

# Get default profile ID
profile="$(gsettings get org.gnome.Terminal.ProfilesList default)"
profile="${profile:1:-1}" # remove leading and trailing single quotes

case "$mode" in
# Export profile
export)
dconf dump "/org/gnome/terminal/legacy/profiles:/:$profile/" > "$filename"
echo "Saved the default profile $profile in $filename"
;;

# Import profile
import)
[[ ! -r "$filename" ]] && err "Failed to read from file $filename"
dconf load "/org/gnome/terminal/legacy/profiles:/:$profile/" < "$filename"
echo "Loaded $filename into the default profile $profile"
;;

*)
usage "Incorrect mode: $mode"
;;
esac
9 changes: 9 additions & 0 deletions terminal/terminal.gnome
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[/]
background-color='rgb(53,52,52)'
visible-name='jldeen'
use-theme-colors=false
palette=['rgb(7,54,66)', 'rgb(220,50,47)', 'rgb(133,153,0)', 'rgb(181,137,0)', 'rgb(38,139,210)', 'rgb(211,54,130)', 'rgb(42,161,152)', 'rgb(238,232,213)', 'rgb(209,164,231)', 'rgb(203,75,22)', 'rgb(88,110,117)', 'rgb(101,123,131)', 'rgb(131,148,150)', 'rgb(108,113,196)', 'rgb(147,161,161)', 'rgb(253,246,227)']
use-theme-transparency=false
foreground-color='rgb(201,201,201)'
use-system-font=false
font='SourceCodePro Nerd Font Mono 12'
Loading

0 comments on commit a767f6c

Please sign in to comment.