diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 08353e0..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at github@gatti.pl. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md index 43afe75..5c2a4f5 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,27 @@ -# dotfiles -User-specific application configuration is traditionally stored in so called dotfiles. Dotfiles are plain text configuration files on Unix-y systems for things like our shell, ~/.zshrc, our editor in ~/.vimrc, and many others. They are called "dotfiles" as they typically are named with a leading . making them hidden files on your system, although this is not a strict requirement. +# Changes in this fork -Since these files are all plain text, we can gather them together in a git repository and use that to track the changes you make over time. +Most changes in the folder ./startup. +If you want to use the startup settings I suggest you fork this repo, make your changes, then run this command: +`cp ./startup/boot.cmd shell:startup` -## Install the Windows Subsystem for Linux -Before installing any Linux distros for WSL, you must ensure that the "Windows Subsystem for Linux" optional feature is enabled: +This will make everything in the startup folder be used at startup. -1. Open PowerShell as Administrator and run: -``` -Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -``` -2. Restart your computer when prompted. -3. To download distros using PowerShell, use curl. -``` -curl.exe -L -o ubuntu-1804.appx https://aka.ms/wsl-ubuntu-1804 -``` -Note: Windows 10 Spring 2018 Update (or later) includes the popular curl command-line utility with which you can invoke web requests from the command line. +## Todo +- some kind of sync/deployment of files in this repo to my hosts? +- Window/tile manager +- better sync, YADM? +- sync settings to remote servers +- gitconfig? + +Done: + +- Personal settings and preferences + +- WIP: keybinds.ahk - Global keybinds to stop bad habits, increase productivity +- global powershell profile for productivity +- windows terminal settings sync +- "autoupdates" via startup script +- bash-like aliases in powershell +- personal aliases for WSL +- Zsh + autosuggestions in wsl (needs verification from scratch install) \ No newline at end of file diff --git a/bootstrap/unix-settings.json b/bootstrap/unix-settings.json index 5cd5c89..0955fae 100644 --- a/bootstrap/unix-settings.json +++ b/bootstrap/unix-settings.json @@ -1,76 +1,39 @@ { "personal": { - "name": "Matheus Rocha Vieira", - "email": "matheusrv@email.com", - "githubuser": "MatheusRV", - "defaultfolder": "/mnt/d/Cloud/GitHub" + "name": "Audun L. Solemdal", + "email": "solomson@email.com", + "githubuser": "solomson", + "defaultfolder": "/mnt/c/appl/Dev" }, "programs": [ { "program": "ssh", "name": "Secure Shell (SSH)", - "installation": "true", - "default": false - }, - { - "program": "protobuf", - "name": "Google Protobuf", "installation": "false", "default": false }, { "program": "azurecli", "name": "Azure Comand-line Interface", - "installation": "false", - "default": false - }, - { - "program": "herokucli", - "name": "Heroku Comand-line Interface", - "installation": "false", - "default": false - }, - { - "program": "gcloudcli", - "name": "Google Cloud Comand-line Interface", - "installation": "false", - "default": false - }, - { - "program": "gcloudsdk", - "name": "Google Cloud Software Development Kit", - "installation": "false", - "default": false - }, - { - "program": "rlang", - "name": "R Lang", "installation": "true", - "default": false - }, - { - "program": "rstudio", - "name": "RStudio", - "installation": "false", - "default": false, - "dependencies": "rlang" + "default": true }, { "program": "powershell", "name": "PowerShell", - "installation": "false", - "default": false + "installation": "true", + "default": true }, { "program": "dotnet", "name": "dotNet", - "installation": "false", + "installation": "true", "default": false }, { "program": "dotnetnuget", "name": "dotNet nuGet", - "installation": "false", + "installation": "true", "default": false, "dependencies": "dotnet" }, @@ -92,35 +55,9 @@ { "program": "nginx", "name": "Nginx", - "installation": "false", - "default": false - }, - { - "program": "php", - "name": "PHP Hypertext Preprocessor", "installation": "true", "default": false }, - { - "program": "php-composer", - "name": "PHP Composer", - "installation": "false", - "default": false, - "dependencies": "php" - }, - { - "program": "php-laravel", - "name": "Laravel", - "installation": "false", - "default": false, - "dependencies": "php" - }, - { - "program": "mysql", - "name": "MySQL", - "installation": "false", - "default": false - }, { "program": "mysql-phpmyadmin", "name": "phpMyAdmin", @@ -167,36 +104,6 @@ "default": false, "config": true }, - { - "program": "yarn-strapi", - "name": "Strapi", - "installation": "false", - "default": false, - "dependencies": "nvm" - }, - { - "program": "yarn-localtunnel", - "name": "LocalTunnel", - "installation": "false", - "default": false, - "dependencies": "nvm", - "hostname": "matheusrv1", - "port": "60000" - }, - { - "program": "yarn-prettier", - "name": "Prettier", - "installation": "false", - "default": false, - "dependencies": "nvm" - }, - { - "program": "yarn-leasot", - "name": "Leasot", - "installation": "false", - "default": false, - "dependencies": "nvm" - }, { "program": "anaconda", "name": "Anaconda", @@ -236,26 +143,6 @@ "default": false, "dependencies": "pyenv" }, - { - "program": "golang", - "name": "GoLang", - "installation": "true", - "default": false - }, - { - "program": "rvm", - "name": "Ruby Version Manager", - "installation": "true", - "default": false, - "config": true - }, - { - "program": "ruby-jekyll", - "name": "Jekyll", - "installation": "false", - "default": false, - "dependencies": "rvm" - }, { "program": "vagrant", "name": "Vagrant", @@ -266,57 +153,27 @@ "program": "docker", "name": "Docker", "installation": "true", - "default": false, + "default": true, "config": true }, { "program": "docker-compose", "name": "Docker Compose", - "installation": "false", + "installation": "true", "default": true }, { "program": "kubectl", "name": "Kubernetes", - "installation": "false", - "default": false + "installation": "true", + "default": true }, { "program": "kubernetes-helm", "name": "Kubernetes Helm", - "installation": "false", - "default": false, - "dependencies": "kubectl" - }, - { - "program": "mosh", - "name": "Mosh", - "installation": "false", - "default": false - }, - { - "program": "shfmt", - "name": "shfmt", - "installation": "false", - "default": false - }, - { - "program": "shellcheck", - "name": "ShellCheck", - "installation": "true", - "default": false - }, - { - "program": "x11server", - "name": "X11 Server", "installation": "true", - "default": false - }, - { - "program": "netkit", - "name": "NetKit", - "installation": "false", - "default": false + "default": true, + "dependencies": "kubectl" } ], "configurations": { diff --git a/bootstrap/version.json b/bootstrap/version.json index 892d905..9900628 100644 --- a/bootstrap/version.json +++ b/bootstrap/version.json @@ -1,7 +1,7 @@ { "PROTOC_VERSION": "3.5.1", "DOTNET_VERSION": "2.1.4", - "POWERSHELL_VERSION": "6.2.0", + "POWERSHELL_VERSION": "7.0.0", "APACHE_VERSION": "2", "MYSQL_SRV_VERSION": "5.7", "POSTGIS_VERSION": "2.4.4", @@ -17,7 +17,7 @@ "GOLANG_VERSION": "1.12.1", "VAGRANT_VERSION": "2.2.5", "DOCKER_COMPOSE_VERSION": "1.24.0", - "KUBECTL_VERSION": "1.10.0", + "KUBECTL_VERSION": "1.14.8", "KUBERNETES_HELM_VERSION": "2.6.1", "SHFMT_VERSION": "2.6.4", "NETKIT_VERSION": "2.8", diff --git a/bootstrap/w10-settings.json b/bootstrap/w10-settings.json index edad069..fe862b3 100644 --- a/bootstrap/w10-settings.json +++ b/bootstrap/w10-settings.json @@ -1,45 +1,27 @@ { "programs": [ - { - "program": "geforce-experience", - "name": "GeForce Experience", - "installation": true, - "default": true - }, - { - "program": "geforce-driver", - "name": "GeForce Game Ready Driver", - "installation": true, - "default": true - }, { "program": "docker-desktop", "name": "Docker Desktop", - "installation": true, + "installation": false, "default": true }, { "program": "dotnet", "name": "dotNet Framework 3.5 (include dotNet 2.5 and 3.0)", - "installation": true, + "installation": false, "default": true }, { "program": "github-desktop", "name": "GitHub Desktop", - "installation": true, + "installation": false, "default": true }, - { - "program": "vscode", - "name": "VSCode", - "installation": true, - "default": true - }, { "program": "hyperv", "name": "Hyper-V", - "installation": true, + "installation": false, "default": true }, { @@ -48,112 +30,22 @@ "installation": false, "default": true }, - { - "program": "jdk8", - "name": "Java Development Kit 8", - "installation": false, - "default": false - }, - { - "program": "wsl", - "name": "Windows Linux Subsystem (Ubuntu 18.04)", - "installation": false, - "default": true - }, - { - "program": "pgadmin", - "name": "pgAdmin", - "installation": false, - "default": false - }, - { - "program": "httrack", - "name": "HTTrack", - "installation": true, - "default": false - }, - { - "program": "bitwarden", - "name": "BitWarden", - "installation": true, - "default": false - }, { "program": "ccleaner", "name": "CCleaner", - "installation": true, - "default": false - }, - { - "program": "polar", - "name": "Polar Bookshelf", - "installation": true, - "default": false - }, - { - "program": "qbittorrent", - "name": "qBitorrent", - "installation": true, - "default": false - }, - { - "program": "sharex", - "name": "ShareX", - "installation": true, - "default": false - }, - { - "program": "station", - "name": "Station", - "installation": true, - "default": false - }, - { - "program": "vlc", - "name": "VLC Media Player", - "installation": true, - "default": false - }, - { - "program": "spotify", - "name": "Spotify", "installation": false, "default": false }, { "program": "discord", "name": "Discord", - "installation": true, - "default": false - }, - { - "program": "steam", - "name": "Steam", - "installation": true, + "installation": false, "default": false }, - { - "program": "google-backup-and-sync", - "name": "Google Backup and Sync", - "installation": true, - "default": true - }, { "program": "dropbox", "name": "Dropbox", - "installation": true, - "default": true - }, - { - "program": "megasync", - "name": "Mega", - "installation": true, - "default": true - }, - { - "program": "dell-update", - "name": "Dell Update", - "installation": true, + "installation": false, "default": true } ] diff --git a/configurations/alias.sh b/configurations/alias.sh index e125770..c33c2e3 100644 --- a/configurations/alias.sh +++ b/configurations/alias.sh @@ -1,114 +1,112 @@ #!/bin/bash PREVIOUS_PWD="$1" -if [ "$(jq -r '.configurations.debug' "${PREVIOUS_PWD}"/bootstrap/unix-settings.json)" == true ]; then +if [ "$(jq -r ".configurations.debug" "${PREVIOUS_PWD}"/bootstrap/unix-settings.json)" == true ]; then set +e else set -e fi -defaultfolder="$(jq -r '.personal.defaultfolder' "${PREVIOUS_PWD}"/bootstrap/unix-settings.json)" +defaultfolder="$(jq -r ".personal.defaultfolder" "${PREVIOUS_PWD}"/bootstrap/unix-settings.json)" echo " -# ls aliases -alias la=\"ls -al\" -alias ls=\"ls -h --color --group-directories-first\" # flat view w/ directories first -alias l=\"ls -h --color --group-directories-first\" # same as above -alias ll=\"ls -lv --group-directories-first\" # non-flat view -alias lm=\"ll | more\" - -# Folder alias -alias hdir=\"cd ${HOME}\" -alias homedir=\"cd ${HOME}\" -# shellcheck disable=SC2139 -alias wdir=\"cd ${defaultfolder}\" -# Quick parent-directory aliases -alias ..=\"cd ..\" -alias ...=\"cd ../..\" -alias .4=\"cd ../../..\" -alias .5=\"cd ../../../..\" -alias .6=\"cd ../../../../..\" -alias .7=\"cd ../../../../../..\" -alias .8=\"cd ../../../../../../..\" -alias .9=\"cd ../../../../../../../..\" - -# File and Folder Permission -alias mx=\"chmod a+x\" -alias 000=\"chmod 000\" -alias 644=\"chmod 644\" -alias 755=\"chmod 755\" -alias 777=\"chmod 777\" +# Extra to path +PATH=$PATH:~/path +PATH=$PATH:~/.local/bin -# Others -alias editbash=\"nano ${HOME}/.bashrc\" -alias editba=\"nano ${HOME}/.bash_aliases\" -alias resource=\"source ${HOME}/.bashrc\" -alias hosts=\"nano /mnt/c/Windows/System32/drivers/etc/hosts\" -alias code=\"code .\" -alias np=\"cmd.exe /c notepad\" - -#NetWork -alias ip=\"curl ipinfo.io/ip\" -alias ips=\"ifconfig -a | perl -nle'/(\d+.\d+.\d+.\d+)/ && print \$1'\" -alias speedtest=\"wget -O /dev/null http://speedtest.wdc01.softlayer.com/downloads/test100.zip\" - -# Handy Extract Program -function extract() -{ - if [ -f \$1 ] ; then - case \$1 in - *.tar.bz2) tar xvjf \$1 ;; - *.tar.gz) tar xvzf \$1 ;; - *.bz2) bunzip2 \$1 ;; - *.rar) unrar x \$1 ;; - *.gz) gunzip \$1 ;; - *.tar) tar xvf \$1 ;; - *.tbz2) tar xvjf \$1 ;; - *.tgz) tar xvzf \$1 ;; - *.zip) unzip \$1 ;; - *.Z) uncompress \$1 ;; - *.7z) 7z x \$1 ;; - *) echo \"'\$1' cannot be extracted via >extract<\" ;; - esac - else - echo \"'\$1' is not a valid file!\" - fi +# Custom functions + +# git functions + +function com(){ + git commit -m $1 } - - -# Make Dir and CD to it -function mcd () -{ - mkdir -p \$1 - cd \$1 + +function gadd(){ + git add $1 } - -# Switch a File or Folder -function swap() -{ - if [ ! -z \"\$2\" ] && [ -e \"\$1\" ] && [ -e \"\$2\" ] && ! [ \"\$1\" -ef \"\$2\" ] && (([ -f \"\$1\" ] && [ -f \"\$2\" ]) || ([ -d \"\$1\" ] && [ -d \"\$2\" ])) ; then - tmp=$(mktemp -d $(dirname \"\$1\")/XXXXXX) - mv \"\$1\" \"\$tmp\" && mv \"\$2\" \"\$1\" && mv \"\$tmp\"/\"\$1\" \"\$2\" - rmdir \"\$tmp\" - else - echo \"Usage: swap file1 file2 or swap dir1 dir2\" - fi + +function acom(){ + git add $1 + git commit -m $2 } - -# Creates an archive (*.tar.gz) from given directory. -function maketar() { tar cvzf \"\${1%%/}.tar.gz\" \"\${1%%/}/\"; } - -# Create a ZIP archive of a file or folder. -function makezip() { zip -r \"\${1%%/}.zip\" \"\$1\" ; } - -# Make your directories and files access rights sane. -function sanitize() { chmod -R u=rwX,g=rX,o= \"\$@\" ;} - -cd ${defaultfolder} -" >>"${HOME}"/.bash_aliases - -if [[ ! "$(uname -r)" =~ "Microsoft$" ]]; then - { - # Alias to run Windows cmd.exe from WSL - alias cmd="/mnt/c/Windows/System32/cmd.exe" - alias cmdc="/mnt/c/Windows/System32/cmd.exe /c" - } >>"${HOME}"/.bash_aliases -fi + +# ALIASES +# container aliases +alias d="docker" +alias doc="docker-compose" +alias k="kubectl" +#alias fsync ="fluxctl sync --k8s-fwd-ns flux" + + +# ls aliases +alias la="ls -al" +alias ls="ls -h --color --group-directories-first" # flat view w/ directories first +alias l="ls -h --color --group-directories-first" # same as above +alias ll="ls -lv --group-directories-first" # non-flat view +alias lm="ll | more" + +# Quick parent-directory aliases +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." +alias cl="cd $_" # cd to last argument in previous command + +#CD to Specific folders + +alias home="cd ~" +alias appl="cd /mnt/c/appl" +alias repos="cd /mnt/c/appl/repos" +alias progs="cd /mnt/c/appl/progs" +alias certs="cd /mnt/c/appl/certs" +alias dotfiles="cd /mnt/c/appl/repos/dotfiles" +alias kne="cd /mnt/c/appl/repos/Dhhr.Kneik" +alias kneik="cd /mnt/c/appl/repos/Dhhr.Kneik" + +# Git commands +alias log="git log --oneline" +alias gdiff="git diff" +alias branch="git branch -a" +alias status="git status" +alias reset="git reset --soft" +alias fetch="git fetch" +alias stash="git stash" +alias push="git push origin head" +alias pull="git pull" +alias recent="git for-each-ref --sort -committerdate refs/heads/" +alias glog="git log --graph --pretty oneline --abbrev-commit --decorate" +alias add="gadd" +alias com="gcom" +alias clone="git clone" +alias merge="git merge" + +# Others +alias editbash="nano ${HOME}/.bashrc" +alias editzsh="nano ${HOME}/.zshrc" +alias editba="nano ${HOME}/.bash_aliases" +alias resource="source ${HOME}/.bashrc" +alias hosts="nano /mnt/c/Windows/System32/drivers/etc/hosts" +alias code="code ." +alias np="cmd.exe /c notepad" + +" >>"${HOME}"/.zshrc + + if [[ ! "$(uname -r)" =~ "Microsoft$" ]]; then + { + # Alias to run Windows cmd.exe from WSL + alias cmd="/mnt/c/Windows/System32/cmd.exe" + alias cmdc="/mnt/c/Windows/System32/cmd.exe /c" + } >>"${HOME}"/.zshrc + fi + + prompt_k8s(){ + k8s_current_context=$(kubectl config current-context 2> /dev/null) + if [[ $? -eq 0 ]] ; then echo -e "(${k8s_current_context}) "; fi + + IFS='-' read -ra ADDR <<< "$IN" + for i in "${ADDR[@]}"; do + # process "$i" + done + } + + + PS1+='$(prompt_k8s)' \ No newline at end of file diff --git a/configurations/git/alias-git.sh b/configurations/git/alias-git.sh index 8001318..23942f0 100644 --- a/configurations/git/alias-git.sh +++ b/configurations/git/alias-git.sh @@ -11,33 +11,30 @@ fi git branch 2>/dev/null | sed -e "/^[^*]/d" -e "s/* \(.*\)/ (\1)/" } - # Make Git branch a variable - branch="$(git branch | sed -n -e "s/^\* \(.*\)/\1/p")" +# Make Git branch a variable +branch="$(git branch | sed -n -e "s/^\* \(.*\)/\1/p")" - # Git commands - alias log="git log" - alias wut='git log master...${branch} --oneline' - alias diff="git diff" - alias branch="git branch" - alias status="git status" - alias st="git status" - alias fetch="git fetch" - alias push="git push origin head" - alias pull="git pull" - alias fp="fetch && pull" - alias gmm="git merge master" - alias recent="git for-each-ref --sort=-committerdate refs/heads/" - alias branch_new="git for-each-ref --sort=-committerdate refs/heads/ --format=%(refname:short)" - alias add="git add -A" - alias gac="git add -A && git commit" - alias gsur="git submodule update --remote" - alias glf="git ls-files" - alias gl="git log --graph --pretty=oneline --abbrev-commit --decorate" +# Git commands +alias log="git log" +alias wut='git log master...${branch} --oneline' +alias diff="git diff" +alias branch="git branch" +alias status="git status" +alias fetch="git fetch" +alias push="git push origin head" +alias pull="git pull" +alias recent="git for-each-ref --sort=-committerdate refs/heads/" +alias branch_new="git for-each-ref --sort=-committerdate refs/heads/ --format=%(refname:short)" +alias gadd="git add -A" +alias gl="git log --graph --pretty=oneline --abbrev-commit --decorate" - ## Git branch switching - alias master="git co master" - alias ghp="git co gh-pages" +## Git branch switching +alias master="git co master" +alias master="git co main" +alias prod="git co prod" +alias dev="git co dev" +alias ghp="git co gh-pages" - # Others - alias editgit="nano ~/.gitconfig" +# Others +alias editgit="code ~/.gitconfig" } >>"${HOME}"/./bashrc diff --git a/configurations/git/gitconfig.txt b/configurations/git/gitconfig.txt index 135f5a7..6646b0e 100644 --- a/configurations/git/gitconfig.txt +++ b/configurations/git/gitconfig.txt @@ -1,6 +1,6 @@ [user] - name = Matheus Rocha Vieira - email = matheusrv@email.com + name = Audun L. Solemdal + email = auls@equinor.com signingkey = KEY_ID [commit] diff --git a/configurations/git/gitignore.txt b/configurations/git/gitignore.txt index 84d48d8..2d705e1 100644 --- a/configurations/git/gitignore.txt +++ b/configurations/git/gitignore.txt @@ -13,6 +13,7 @@ _site *.swp *.vi *.zip +*.gz *~ # OS or Editor folders @@ -29,13 +30,6 @@ _site nbproject Thumbs.db -# Komodo -.komodotools -*.komodoproject - -# grunt-html-validation -validation-report.json -validation-status.json # Folders to ignore bower_components diff --git a/main.ps1 b/main.ps1 index d366d67..2b54dd5 100644 --- a/main.ps1 +++ b/main.ps1 @@ -4,7 +4,6 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: Write-Output "`n [ START ] Configuring System Run" $StopWatch = [System.Diagnostics.Stopwatch]::StartNew() Set-ExecutionPolicy RemoteSigned - $ComputerName = Get-Random -InputObject "Turing", "Knuth", "Berners-Lee", "Torvalds", "Hopper", "Ritchie", "Stallman", "Gosling", "Church", "Dijkstra", "Cooper", "Gates", "Jobs", "Wozniak", "Zuckerberg", "Musk", "Nakamoto", "Dotcom", "Snowden", "Kruskal", "Neumann" $StopWatch.Stop() $StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds Write-Output " [ DONE ] Configuring System Run ... $StopWatchElapsed seconds`n" @@ -21,6 +20,7 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) RefreshEnv cinst -y boxstarter + Import-Module Boxstarter.Chocolatey $StopWatch.Stop() $StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds @@ -171,8 +171,8 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: Set-NetConnectionProfile -NetworkCategory Private Write-Output "`n [ DOING ] Setting dark theme as default" Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Value 0 - Write-Output "`n [ DOING ] Show hidden files, Show protected OS files, Show file extensions" - Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions + Write-Output "`n [ DOING ] Show hidden files, Show file extensions" + Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced HideFileExt "0" #--- File Explorer Settings --- Write-Output "`n [ DOING ] Adds things back in your left pane like recycle bin" @@ -181,12 +181,21 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: Write-Output "`n [ DOING ] Opens PC to This PC, not quick access" Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1 Write-Output "`n [ DOING ] Taskbar where window is open for multi-monitor" - Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2 - Write-Output "`n [ DOING ] Disable Quick Access: Recent Files" - Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 0 - Write-Output "`n [ DOING ] Disable Quick Access: Frequent Folders" - Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 0 + Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 0 + Write-Output "`n [ DOING ] Enable Quick Access: Recent Files" + Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 1 + Write-Output "`n [ DOING ] Enable Quick Access: Frequent Folders" + Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 1 + Write-Output "`n [ DOING ] Removing 3D Objects folder" + Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}\' + #pictures + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{0ddd015d-b06c-45d5-8c4c-f59713854639}\PropertyBag' -Name Thispcpolicy "Show" + # videos + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag' -Name Thispcpolicy "Hide" Stop-Process -processName: Explorer -force # This will restart the Explorer service to make this work. + # music + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag' -Name Thispcpolicy "Hide" + } Write-Output "`n [ START ] Unistall Windows10 Unnecessary and Blotware Apps" $StopWatch = [System.Diagnostics.Stopwatch]::StartNew() @@ -295,9 +304,6 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: $StopWatch.Stop() $StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds Write-Output " [ DONE ] Remove Unnecessary Windows Registries ... $StopWatchElapsed seconds`n" - if ($env:computername -ne $ComputerName) { - Rename-Computer -NewName $ComputerName - } } else { $PurgeMode = Read-Host -Prompt "`n Enable Purge Mode (y/N)" @@ -364,19 +370,32 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: "robotofonts" #Default Install "k-litecodecpackfull" - "ffmpeg" - "jre8" - "7zip" "googlechrome" - "autohotkey" "sysinternals" # Dev Tools Must Have "git.install" "lepton" "powershell" - "virtualbox" "vagrant" - "putty" + "vscode" + "greenshot" + "GoogleChrome" + # Work use + "wsl" + "wsl-ubuntu-1804" + "docker" + "slack" + "microsoft-windows-terminal" + "azure-cli" + "git" + "poshgit" + "dotnetcore-sdk" + ##"kubernetes-helm --version 2.13.1" + # Private use + "steam" + #"leagueoflegends" + "vlc" + ) ForEach ($Program in $Programs) { Write-Output "`n [ START ] $Program" @@ -386,6 +405,9 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: $StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds Write-Output " [ DONE ] $Program ... $StopWatchElapsed seconds`n" } + RefreshEnv + code --install-extension Shan.code-settings-sync # Vscode needs settings sync from github gist + $AllPrograms = Get-Content 'bootstrap\w10-settings.json' | Out-String | ConvertFrom-Json ForEach ($row in $AllPrograms.programs) { $ProgramName = $row.name @@ -400,17 +422,25 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: Write-Output " [ DONE ] $ProgramName ... $StopWatchElapsed seconds`n" } } + + # Install PowerShell modules + $Modules = @( + "poshgit" + "Graphical" + "MSTerminalSettings" + "Terminal-Icons" + "Pansies" + "PowerLine" + "PSProfile" + ) + + Foreach ($module in Modules){ + Install-Module -Name $module -Force -AllowClobber + } + Enable-UAC RefreshEnv Start-Process -FilePath 'autoruns' -Wait - $OzoneInstall = Read-Host -Prompt "`n Do you wish to install Ozone Exon V30 Mice Driver? (Y/n)" - if ([string]::IsNullOrWhiteSpace($OzoneInstall) -Or $OzoneInstall -eq 'Y' -Or $OzoneInstall -eq 'y') { - Start-Process -FilePath 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' -ArgumentList 'https://www.ozonegaming.com/product/exon-v30' - } - $OfficeInstall = Read-Host -Prompt "`n Do you wish to install Office? (Y/n)" - if ([string]::IsNullOrWhiteSpace($OfficeInstall) -Or $OfficeInstall -eq 'Y' -Or $OfficeInstall -eq 'y') { - Start-Process -FilePath 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' -ArgumentList 'https://old.reddit.com/r/sjain_guides/comments/9m4m0k/microsoft_office_201319_simple_method_to_download' - } $AdobeInstall = Read-Host -Prompt "`n Do you wish to install Adobe Products? (Y/n)" if ([string]::IsNullOrWhiteSpace($AdobeInstall) -Or $AdobeInstall -eq 'Y' -Or $AdobeInstall -eq 'y') { Start-Process -FilePath 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe' -ArgumentList 'https://old.reddit.com/r/sjain_guides/wiki/downloads' @@ -421,12 +451,6 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: $regKeyHttp = $regKey -f 'http' $regKeyHttps = $regKey -f 'https' switch -Regex ($defaultBrowser.ToLower()) { - # Internet Explorer - 'ie|internet|explorer' { - Set-ItemProperty $regKeyHttp -name ProgId IE.HTTP - Set-ItemProperty $regKeyHttps -name ProgId IE.HTTPS - break - } # Firefox 'ff|firefox' { Set-ItemProperty $regKeyHttp -name ProgId FirefoxURL @@ -439,24 +463,12 @@ if (([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:: Set-ItemProperty $regKeyHttps -name ProgId ChromeHTML break } - # Safari - 'sa*|apple' { - Set-ItemProperty $regKeyHttp -name ProgId SafariURL - Set-ItemProperty $regKeyHttps -name ProgId SafariURL - break - } - # Opera - 'op*' { - Set-ItemProperty $regKeyHttp -name ProgId Opera.Protocol - Set-ItemProperty $regKeyHttps -name ProgId Opera.Protocol - break - } - } } Set-DefaultBrowser chrome $GlobalStopWatch.Stop() $GlobalStopWatchElapsed = $StopWatch.Elapsed.TotalSeconds Write-Output "`n Total Execution Time ... $GlobalStopWatchElapsed seconds`n" + } } else { Write-Output "`n [ ERROR ] You must execute this script with administrator privileges`n" diff --git a/main.sh b/main.sh index d72e7bf..ff1d688 100644 --- a/main.sh +++ b/main.sh @@ -14,6 +14,7 @@ EOF if [ -d "${HOME}"/tmp ]; then sudo rm -f -R "${HOME}"/tmp fi + HOME=/mnt/c/appl mkdir -p "${HOME}"/tmp cd "${HOME}"/tmp || return sudo apt -qq update @@ -69,11 +70,51 @@ EOF unzip libssl-dev ca-certificates + zsh ) trap '' 2 sudo apt -y install "${apps[@]}" trap 2 unset apps + +git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions + + # zsh as default shell +cat << EOF >> ~/.bashrc + if [ -t 1 ]; then + exec zsh + fi + HOME=/mnt/c/appl +EOF + + curl -L git.io/antigen > ~/antigen.zsh + +cat << EOF >> ~/.zshrc +source ~/antigen.zsh +antigen bundle zsh-users/zsh-autosuggestions +source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh + +# Load the oh-my-zsh's library. +antigen use oh-my-zsh + +# Bundles from the default repo (robbyrussell's oh-my-zsh). +antigen bundle git +antigen bundle heroku +antigen bundle pip +antigen bundle lein +antigen bundle command-not-found + +# Syntax highlighting bundle. +antigen bundle zsh-users/zsh-syntax-highlighting + + +antigen bundle zsh-users/zsh-autosuggestions + +# Tell Antigen that you're done. +antigen apply +EOF + + endtime=$(date +%s) printf " [ DONE ] Common Requirements ... %s seconds\n" "$((endtime - starttime))" printf "\n [ START ] Configurating Command Alias" @@ -174,19 +215,19 @@ EOF read -r personalconfig if [ -z "${personalconfig}" ] || [ "${personalconfig}" == Y ] || [ "${personalconfig}" == y ]; then - printf "\n Your Name (Default: Matheus Rocha Vieira): " + printf "\n Your Name (Default: Audun L. Solemdal): " read -r username if [ -z "${username}" ]; then - username="Matheus Rocha Vieira" + username="Audun L. Solemdal" echo "$username" fi git config --global user.name "${username}" jq '.personal.name = "'"${username}"'"' "${PREVIOUS_PWD}"/bootstrap/unix-settings.json | sponge "${PREVIOUS_PWD}"/bootstrap/unix-settings.json unset username - printf "\n Your E-Mail (Default: matheusrv@email.com): " + printf "\n Your E-Mail (Default: solomson@email.com): " read -r email if [ -z "${email}" ]; then - email="matheusrv@email.com" + email="solomson@email.com" echo "$email" fi git config --global user.email "${email}" @@ -195,10 +236,10 @@ EOF fi jq '.personal.email = "'"${email}"'"' "${PREVIOUS_PWD}"/bootstrap/unix-settings.json | sponge "${PREVIOUS_PWD}"/bootstrap/unix-settings.json unset email - printf "\n Your GitHub Username (Default: MatheusRV): " + printf "\n Your GitHub Username (Default: solomson): " read -r githubuser if [ -z "${githubuser}" ]; then - githubuser="MatheusRV" + githubuser="solomson" echo "$githubuser" fi jq '.personal.githubuser = "'"${githubuser}"'"' "${PREVIOUS_PWD}"/bootstrap/unix-settings.json | sponge "${PREVIOUS_PWD}"/bootstrap/unix-settings.json diff --git a/momspc.ps1 b/momspc.ps1 new file mode 100644 index 0000000..8529fcf --- /dev/null +++ b/momspc.ps1 @@ -0,0 +1,233 @@ +$Privacy = Read-Host -Prompt "`n Do you care about privacy? (Y/n)" +if ([string]::IsNullOrWhiteSpace($Privacy) -Or $Privacy -eq 'Y' -Or $Privacy -eq 'y') { + Write-Output "`n [ START ] Protecting Privacy" + $StopWatch = [System.Diagnostics.Stopwatch]::StartNew() + #Disables Windows Feedback Experience + Write-Output " [ DOING ] Disabling Windows Feedback Experience program" + $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" + If (Test-Path $Advertising) { + Set-ItemProperty $Advertising Enabled -Value 0 + } + #Stops Cortana from being used as part of your Windows Search Function + Write-Output " [ DOING ] Stopping Cortana from being used as part of your Windows Search Function" + $Search = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + If (Test-Path $Search) { + Set-ItemProperty $Search AllowCortana -Value 0 + } + #Disables Web Search in Start Menu + Write-Output " [ DOING ] Disabling Bing Search in Start Menu" + $WebSearch = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" + Set-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" BingSearchEnabled -Value 0 + If (!(Test-Path $WebSearch)) { + New-Item $WebSearch + } + New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search' -Name DisableWebSearch -Type DWORD -Value 1 + Set-ItemProperty $WebSearch DisableWebSearch -Value 1 + #Stops the Windows Feedback Experience from sending anonymous data + Write-Output " [ DOING ] Stopping the Windows Feedback Experience program" + $Period = "HKCU:\Software\Microsoft\Siuf\Rules" + If (!(Test-Path $Period)) { + New-Item $Period + } + Set-ItemProperty $Period PeriodInNanoSeconds -Value 0 + #Prevents bloatware applications from returning and removes Start Menu suggestions + Write-Output " [ DOING ] Adding Registry key to prevent bloatware apps from returning" + $registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" + $registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" + If (!(Test-Path $registryPath)) { + New-Item $registryPath + } + Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1 + If (!(Test-Path $registryOEM)) { + New-Item $registryOEM + } + Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0 + Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0 + Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0 + Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0 + Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0 + Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0 + #Preping mixed Reality Portal for removal + Write-Output " [ DOING ] Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" + $Holo = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Holographic" + If (Test-Path $Holo) { + Set-ItemProperty $Holo FirstRunSucceeded -Value 0 + } + #Disables Wi-fi Sense + Write-Output " [ DOING ] Disabling Wi-Fi Sense" + $WifiSense1 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting" + $WifiSense2 = "HKLM:\SOFTWARE\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots" + $WifiSense3 = "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\config" + If (!(Test-Path $WifiSense1)) { + New-Item $WifiSense1 + } + Set-ItemProperty $WifiSense1 Value -Value 0 + If (!(Test-Path $WifiSense2)) { + New-Item $WifiSense2 + } + Set-ItemProperty $WifiSense2 Value -Value 0 + Set-ItemProperty $WifiSense3 AutoConnectAllowedOEM -Value 0 + #Disables live tiles + Write-Output " [ DOING ] Disabling live tiles" + $Live = "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" + If (!(Test-Path $Live)) { + New-Item $Live + } + Set-ItemProperty $Live NoTileApplicationNotification -Value 0 + #Turns off Data Collection via the AllowTelemtry key by changing it to 0 + Write-Output " [ DOING ] Turning off Data Collection" + $DataCollection1 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\DataCollection" + $DataCollection2 = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" + $DataCollection3 = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\DataCollection" + If (Test-Path $DataCollection1) { + Set-ItemProperty $DataCollection1 AllowTelemetry -Value 0 + } + If (Test-Path $DataCollection2) { + Set-ItemProperty $DataCollection2 AllowTelemetry -Value 0 + } + If (Test-Path $DataCollection3) { + Set-ItemProperty $DataCollection3 AllowTelemetry -Value 0 + } + #Disabling Location Tracking + Write-Output " [ DOING ] Disabling Location Tracking" + $SensorState = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Sensor\Overrides\{BFA794E4-F964-4FDB-90F6-51056BFE4B44}" + $LocationConfig = "HKLM:\SYSTEM\CurrentControlSet\Services\lfsvc\Service\Configuration" + If (!(Test-Path $SensorState)) { + New-Item $SensorState + } + Set-ItemProperty $SensorState SensorPermissionState -Value 0 + If (!(Test-Path $LocationConfig)) { + New-Item $LocationConfig + } + Set-ItemProperty $LocationConfig Status -Value 0 + #Disables People icon on Taskbar + Write-Output " [ DOING ] Disabling People icon on Taskbar" + $People = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" + If (!(Test-Path $People)) { + New-Item $People + } + Set-ItemProperty $People PeopleBand -Value 0 + #Disables scheduled tasks that are considered unnecessary + Write-Output " [ DOING ] Disabling scheduled tasks" + Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask + Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask + Get-ScheduledTask Consolidator | Disable-ScheduledTask + Get-ScheduledTask UsbCeip | Disable-ScheduledTask + Get-ScheduledTask DmClient | Disable-ScheduledTask + Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask + Write-Output " [ DOING ] Stopping and disabling WAP Push Service" + #Stop and disable WAP Push Service + Stop-Service "dmwappushservice" + Set-Service "dmwappushservice" -StartupType Disabled + Write-Output " [ DOING ] Stopping and disabling Diagnostics Tracking Service" + #Disabling the Diagnostics Tracking Service + Stop-Service "DiagTrack" + Set-Service "DiagTrack" -StartupType Disabled + $StopWatch.Stop() + $StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds + Write-Output " [ DONE ] Protecting Privacy ... $StopWatchElapsed seconds`n" +} +$WindowsConfig = Read-Host -Prompt "`n Do wish configure Windows? (Y/n)" +if ([string]::IsNullOrWhiteSpace($WindowsConfig) -Or $WindowsConfig -eq 'Y' -Or $WindowsConfig -eq 'y') { + Write-Output "`n [ DOING ] Setting network category to private" + Set-NetConnectionProfile -NetworkCategory Private + Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced HideFileExt "0" + #--- File Explorer Settings --- + Write-Output "`n [ DOING ] Opens PC to This PC, not quick access" + Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1 + Write-Output "`n [ DOING ] Taskbar where window is open for multi-monitor" + Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 0 + Write-Output "`n [ DOING ] Enable Quick Access: Recent Files" + Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 1 + Write-Output "`n [ DOING ] Enable Quick Access: Frequent Folders" + Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 1 + Write-Output "`n [ DOING ] Removing 3D Objects folder" + Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}\' + # videos + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{35286a68-3c57-41a1-bbb1-0eae73d76c95}\PropertyBag' -Name Thispcpolicy "Hide" + Stop-Process -processName: Explorer -force # This will restart the Explorer service to make this work. + # music + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\{a0c69a99-21c8-4671-8703-7934162fcf1d}\PropertyBag' -Name Thispcpolicy "Hide" + Stop-Process -processName: Explorer -force # This will restart the Explorer service to make this work. + +} +Write-Output "`n [ START ] Unistall Windows10 Unnecessary and Blotware Apps" +$StopWatch = [System.Diagnostics.Stopwatch]::StartNew() +$AppXApps = @( + "*Microsoft.BingNews*" + "*Microsoft.Messaging*" + "*Microsoft.Microsoft3DViewer*" + "*Microsoft.MicrosoftOfficeHub*" + "*Microsoft.MicrosoftSolitaireCollection*" + "*Microsoft.NetworkSpeedTest*" + "*Microsoft.Office.Sway*" + "*Microsoft.OneConnect*" + "*Microsoft.People*" + "*Microsoft.Print3D*" + "*Microsoft.CommsPhone*" + "*Microsoft.WindowsAlarms*" + "*Microsoft.WindowsCamera*" + "*microsoft.windowscommunicationsapps*" + "*Microsoft.WindowsFeedbackHub*" + "*Microsoft.WindowsMaps*" + "*Microsoft.WindowsSoundRecorder*" + "*Microsoft.Xbox.TCUI*" + "*Microsoft.XboxApp*" + "*Microsoft.XboxGameOverlay*" + "*Microsoft.XboxIdentityProvider*" + "*Microsoft.XboxSpeechToTextOverlay*" + "*Microsoft.ZuneMusic*" + "*Microsoft.People*" + "*Microsoft.ZuneVideo*" + #Sponsored Windows 10 AppX Apps + #Add sponsored/featured apps to remove in the "*AppName*" format + "*EclipseManager*" + "*Autodesk*" + "*BubbleWitch*" + "*MarchofEmpires*" + "*McAfee*" + "*Minecraft*" + "*Netflix*" + "*ActiproSoftwareLLC*" + "*AdobeSystemsIncorporated.AdobePhotoshopExpress*" + "*Duolingo-LearnLanguagesforFree*" + "*PandoraMediaInc*" + "*CandyCrush*" + "*Wunderlist*" + "*Flipboard*" + "*Twitter*" + "*Facebook*" + "*Spotify*" + #Optional: Typically not removed but you can if you need to for some reason + #"*Microsoft.Advertising.Xaml_10.1712.5.0_x64__8wekyb3d8bbwe*" + #"*Microsoft.Advertising.Xaml_10.1712.5.0_x86__8wekyb3d8bbwe*" + #"*Microsoft.BingWeather*" + #"*Microsoft.MSPaint*" + #"*Microsoft.MicrosoftStickyNotes*" + #"*Microsoft.Windows.Photos*" + #"*Microsoft.WindowsCalculator*" + #"*Microsoft.WindowsStore*" +) +foreach ($App in $AppXApps) { + Write-Output " [ DOING ] Removing $App from registry" + Get-AppxPackage -Name $App | Remove-AppxPackage -ErrorAction SilentlyContinue + Get-AppxPackage -Name $App -AllUsers | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue + Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like $App | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue +} +[regex]$WhitelistedApps = 'Microsoft.Paint3D|Microsoft.WindowsCalculator|Microsoft.WindowsStore|Microsoft.Windows.Photos|CanonicalGroupLimited.UbuntuonWindows|Microsoft.XboxGameCallableUI|Microsoft.XboxGamingOverlay|Microsoft.Xbox.TCUI|Microsoft.XboxGamingOverlay|Microsoft.XboxIdentityProvider|Microsoft.MicrosoftStickyNotes|Microsoft.MSPaint*' +Get-AppxPackage -AllUsers | Where-Object { $_.Name -NotMatch $WhitelistedApps } | Remove-AppxPackage +Get-AppxPackage | Where-Object { $_.Name -NotMatch $WhitelistedApps } | Remove-AppxPackage +Get-AppxProvisionedPackage -Online | Where-Object { $_.PackageName -NotMatch $WhitelistedApps } | Remove-AppxProvisionedPackage -Online +$StopWatch.Stop() +$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds +Write-Output " [ DONE ] Unistall Windows10 Unnecessary and Blotware Apps ... $StopWatchElapsed seconds`n" +Write-Output "`n [ START ] Remove Unnecessary Windows Registries" +$StopWatch = [System.Diagnostics.Stopwatch]::StartNew() + +ForEach ($Key in $Keys) { + Write-Output " [ DOING ] Removing $Key from registry" + Remove-Item $Key -Recurse +} +$StopWatch.Stop() +$StopWatchElapsed = $StopWatch.Elapsed.TotalSeconds +Write-Output " [ DONE ] Remove Unnecessary Windows Registries ... $StopWatchElapsed seconds`n" \ No newline at end of file diff --git a/programs/tools-and-services/localtunnel-service.sh b/programs/tools-and-services/localtunnel-service.sh index dc1beff..af56571 100644 --- a/programs/tools-and-services/localtunnel-service.sh +++ b/programs/tools-and-services/localtunnel-service.sh @@ -16,7 +16,7 @@ loopFunction(bool) { if [ \"${bool}\" == false ]; then break fi - lt --port 2200 -s matheusrv; + lt --port 2200 -s solomson; sleep 10; done } diff --git a/programs/vscode.ps1 b/programs/vscode.ps1 deleted file mode 100644 index e8f4411..0000000 --- a/programs/vscode.ps1 +++ /dev/null @@ -1,35 +0,0 @@ -cinst -y vscode - -$Extensions = @( - "aaron-bond.better-comments" - "coenraads.bracket-pair-colorizer" - "kamikillerto.vscode-colorize" - "dbaeumer.vscode-eslint" - "davidanson.vscode-markdownlint" - "hookyqr.minify" - "esbenp.prettier-vscode" - "wallabyjs.quokka-vscode" - "ms-vscode-remote.remote-containers" - "ms-vscode-remote.remote-ssh" - "ms-vscode-remote.remote-ssh-edit" - "ms-vscode-remote.remote-ssh-explorer" - "ms-vscode-remote.remote-wsl" - "ms-vscode-remote.vscode-remote-extensionpack" - "ms-vscode-remote.vscode-remote-extensionpack" - "redhat.vscode-yaml" -) - -ForEach ($Extension in $Extensions) { - Write-Output "Instaling $Extension" - code --install-extension $Extension -} - -#code --install-extension EditorConfig.EditorConfig -#code --install-extension vscodevim.vim -#code --install-extension eamodio.gitlens -#code --install-extension gerane.Theme-Paraisodark -#code --install-extension PeterJausovec.vscode-docker -#code --install-extension ms-vscode.PowerShell -#code --install-extension christian-kohler.path-intellisense -#code --install-extension robertohuertasm.vscode-icons -#code --install-extension streetsidesoftware.code-spell-checker \ No newline at end of file diff --git a/programs/wsl.ps1 b/programs/wsl.ps1 index c5a35c9..1dcc895 100644 --- a/programs/wsl.ps1 +++ b/programs/wsl.ps1 @@ -42,7 +42,7 @@ Ubuntu1804 run apt upgrade -y #Ubuntu1804 run usermod -aG sudo $ComputerName #Ubuntu1804 run config --default-user $ComputerName -Ubuntu1804 run 'git clone https://github.com/MatheusRV/dotfiles && chmod 777 -R dotfiles && cd dotfiles && ./install.sh' +Ubuntu1804 run 'git clone https://github.com/solomson/dotfiles && chmod 777 -R dotfiles && cd dotfiles && ./install.sh' $Programs = @( "vcxsrv" diff --git a/programs/yarn-localtunnel.sh b/programs/yarn-localtunnel.sh index 1dc1018..1a0ba65 100644 --- a/programs/yarn-localtunnel.sh +++ b/programs/yarn-localtunnel.sh @@ -10,6 +10,6 @@ hostname="$(jq -r '.programs[] | select(.program=="yarn-localtunnel").hostname' yarn global add localtunnel sudo chmod a+x "${PREVIOUS_PWD}"/programs/tools-and-services/localtunnel-service.sh sudo cp "${PREVIOUS_PWD}"/programs/tools-and-services/localtunnel-service.sh /etc/init.d/localtunnel -sudo sed -i "/lt --port 2200 -s matheusrv;/c\lt --port ${port} -s ${hostname};" /etc/init.d/localtunnel +sudo sed -i "/lt --port 2200 -s solomson;/c\lt --port ${port} -s ${hostname};" /etc/init.d/localtunnel update-rc.d localtunnel defaults diff --git a/remote-install.ps1 b/remote-install.ps1 deleted file mode 100644 index aa0958b..0000000 --- a/remote-install.ps1 +++ /dev/null @@ -1,9 +0,0 @@ -# Set execution policy to remote signed -Set-ExecutionPolicy RemoteSigned - -#TODO: Folder Control (Redirect For a Temp & Check if folder exist) -#TODO: Welcome Message -#TODO: Manage PowerShell install files dynamic - -RefreshEnv -& .\main.ps1 diff --git a/remote-install.sh b/remote-install.sh deleted file mode 100644 index 2f51705..0000000 --- a/remote-install.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/bash -{ - - : ' - printf "\n [ START ] Version Management Control\n" - starttime=$(date +%s) - trap '' 2 - if ! git clone https://github.com/molovo/lumberjack; then - echo "Download failed downloading molovo/lumberjack! Exiting." - kill $$ - fi - if [ -d /usr/local/bin/lj ]; then - filesha1=find "${PWD}"/lumberjack/lj -type f -print0 | xargs -0 sha1sum | sort | sha1sum - filesha2=find /usr/local/bin/lj -type f -print0 | xargs -0 sha1sum | sort | sha1sum - if [ "$filesha1" != "$filesha2" ]; then - sudo rm -f -R /usr/local/bin/lj - sudo mv lumberjack/lj /usr/local/bin - fi - else - sudo mv lumberjack/lj /usr/local/bin - fi - if ! git clone https://github.com/MatheusRV/dotfiles; then - echo "Download failed downloading matheusrv/dotfiles! Exiting." - kill $$ - fi - filesha1=find "${PWD}"/dotfiles -type f -print0 | xargs -0 sha1sum | awk '{print $1}' | sha1sum - exit 1 - filesha2=find "${PREVIOUS_PWD}" -type f -print0 | xargs -0 sha1sum | sort | sha1sum - if [ "$filesha1" != "$filesha2" ]; then - if [ -d "${PREVIOUS_PWD}"/programs ]; then - filesha1=find "${PWD}"/dotfiles/programs -type f -print0 | xargs -0 sha1sum | sort | sha1sum - filesha2=find "${PREVIOUS_PWD}"/programs -type f -print0 | xargs -0 sha1sum | sort | sha1sum - if [ "$filesha1" != "$filesha2" ]; then - sudo rm -f -R "${PREVIOUS_PWD}"/programs - sudo mv "${PWD}"/dotfiles/programs "${PREVIOUS_PWD}"/programs - fi - else - sudo mv "${PWD}"/dotfiles/programs "${PREVIOUS_PWD}"/programs - fi - if [ -f "${PREVIOUS_PWD}"/main.sh ]; then - filesha1=sha1sum "${PWD}"/dotfiles/main.sh - filesha2=sha1sum "${PREVIOUS_PWD}"/main.sh - if [ "$filesha1" != "$filesha2" ]; then - sudo rm -f -R "${PREVIOUS_PWD}"/programs - sudo mv "${PWD}"/dotfiles/programs "${PREVIOUS_PWD}"/programs - fi - else - sudo mv "${PWD}"/dotfiles/main.sh "${PREVIOUS_PWD}" - fi - fi - if [ -f "${PREVIOUS_PWD}"/bootstrap/version.json ]; then - filesha1=sha1sum "${PWD}"/bootstrap/version.json - filesha2=sha1sum "${PREVIOUS_PWD}"/bootstrap/version.json - if [ "$filesha1" != "$filesha2" ]; then - sudo rm -f "${PREVIOUS_PWD}"/bootstrap/version.json - chmod +x "${PWD}"/bootstrap/version.json - sudo mv "${PWD}"/bootstrap/version.json "${PREVIOUS_PWD}"/bootstrap - fi - else - chmod +x "${PREVIOUS_PWD}"/bootstrap/version.json - sudo mv "${PWD}"/bootstrap/version.json "${PREVIOUS_PWD}"/bootstrap - fi - if [ -f /usr/local/bin/chkinstall ]; then - filesha1=sha1sum "${PREVIOUS_PWD}"/programs/tools-and-services/chkinstall.sh - filesha2=sha1sum /usr/local/bin/chkinstall - if [ "$filesha1" != "$filesha2" ]; then - sudo rm -f /usr/local/bin/chkinstall - chmod +x "${PREVIOUS_PWD}"/programs/tools-and-services/chkinstall.sh - sudo cp "${PREVIOUS_PWD}"/programs/tools-and-services/chkinstall.sh /usr/local/bin/chkinstall - fi - else - chmod +x "${PREVIOUS_PWD}"/programs/tools-and-services/chkinstall.sh - sudo cp "${PREVIOUS_PWD}"/programs/tools-and-services/chkinstall.sh /usr/local/bin/chkinstall - fi - - lj --file "${PREVIOUS_PWD}"/dotfiles.log --level debug - trap 2 - endtime=$(date +%s) - printf " [ DONE ] Version Control ... %s seconds\n" "$((endtime - starttime))" - ' - "${PREVIOUS_PWD}"/main.sh "${PREVIOUS_PWD}" -} diff --git a/startup/img/linux.jpg b/startup/img/linux.jpg new file mode 100644 index 0000000..1b79672 Binary files /dev/null and b/startup/img/linux.jpg differ diff --git a/startup/img/pwsh.jpg b/startup/img/pwsh.jpg new file mode 100644 index 0000000..053ec97 Binary files /dev/null and b/startup/img/pwsh.jpg differ diff --git a/startup/oh-my-posh/agnoster-customized.json b/startup/oh-my-posh/agnoster-customized.json new file mode 100644 index 0000000..9c21edd --- /dev/null +++ b/startup/oh-my-posh/agnoster-customized.json @@ -0,0 +1,70 @@ +{ + "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", + "blocks": [ + { + "alignment": "right", + "segments": [ + { + "foreground": "#007ACC", + "properties": { + "time_format": "15:04:05" + }, + "style": "plain", + "type": "time" + } + ], + "type": "prompt", + "vertical_offset": -1 + }, + { + "alignment": "left", + "newline": true, + "segments": [ + { + "background": "#ffffff", + "foreground": "#100e23", + "powerline_symbol": "", + "style": "powerline", + "type": "session" + }, + { + "background": "#91ddff", + "foreground": "#100e23", + "powerline_symbol": "", + "properties": { + "folder_icon": "", + "folder_separator_icon": "  ", + "home_icon": "", + "style": "agnoster" + }, + "style": "powerline", + "type": "path" + }, + { + "background": "#95ffa4", + "background_templates": [ + "{{ if or (.Working.Changed) (.Staging.Changed) }}#C19C00{{ end }}", + "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff4500{{ end }}", + "{{ if gt .Ahead 0 }}#B388FF{{ end }}", + "{{ if gt .Behind 0 }}#B388FF{{ end }}" + ], + "foreground": "#193549", + "leading_diamond": "", + "powerline_symbol": "", + "properties": { + "branch_max_length": 25, + "fetch_stash_count": false, + "fetch_status": true, + "fetch_upstream_icon": false, + "template": "{{ .UpstreamIcon }}{{ .HEAD }}{{ .BranchStatus }}{{ if .Working.Changed }}  {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }}  {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }}  {{ .StashCount }}{{ end }}" + }, + "style": "powerline", + "trailing_diamond": "", + "type": "git" + } + ], + "type": "prompt" + } + ], + "final_space": true +} diff --git a/startup/raw/keybinds.ahk b/startup/raw/keybinds.ahk new file mode 100644 index 0000000..058ca71 --- /dev/null +++ b/startup/raw/keybinds.ahk @@ -0,0 +1,74 @@ +#SingleInstance force + +; Default state of lock keys +SetCapsLockState, AlwaysOff +SetScrollLockState, AlwaysOff +return + +; Suspend AutoHotKey +CapsLock & p::Suspend ; +return + +; Google Search highlighted text +CapsLock & Space:: +{ + Send, ^c + Sleep 50 + Run, http://www.google.com/search?q=%clipboard% + Return +} + +; Rebind useless key to braces ++|:: +{ + Send, {RAlt Down}{7}{RAlt Up} + Send, {RAlt Down}{0}{RAlt Up} + return +} + + +; Scroll tab forward (chrome) +CapsLock & WheelDown:: +{ + Send ^{Tab} + sleep 50 + return +} + +; Scroll tab back (chrome) +CapsLock & WheelUp:: +{ + Send, ^+{Tab} + sleep 50 + return +} + +#n:: +if WinExist("Untitled - Notepad") || if WinExist("*Untitled - Notepad") +{ + WinActivate ; Automatically uses the window found above. + Send, {Enter} + Send, {Enter} + return +} +else +{ + Run, notepad.exe + return +} + +; Unused F keys + + +; Mouse click with useless key (right ctrl) +RCtrl:: +{ + Click + Return +} + +#c:: + Send ^c + ClipWait + Clipboard:=Clipboard "" +Return \ No newline at end of file diff --git a/startup/raw/profile.ps1 b/startup/raw/profile.ps1 new file mode 100644 index 0000000..5a62752 --- /dev/null +++ b/startup/raw/profile.ps1 @@ -0,0 +1,351 @@ +# cp ./startup/raw/profile.ps1 $PROFILE.AllUsersAllHosts + +# Default folder +$env:HOME = "C:\Appl" + +# Hold control to skip import of modules, credit @VladimirReshetnikov +Add-Type -AssemblyName WindowsBase +Add-Type -AssemblyName PresentationCore +if (-not [Windows.Input.Keyboard]::IsKeyDown([System.Windows.Input.Key]::LeftCtrl)) { + # Critical Modules + Import-Module "Terminal-icons" + oh-my-posh init pwsh --config C:\appl\repos\dotfiles\startup\oh-my-posh\agnoster-customized.json | Invoke-Expression +} + +$PSDefaultParameterValues["Out-Default:OutVariable"] = "__" # $__ = last output +Set-PSReadLineOption -PredictionSource HistoryAndPlugin + +# Alias + +Set-Alias grep select-string +Set-Alias d docker +Set-Alias doc docker-compose +Set-Alias k kubectl.exe +Set-Alias he helm.exe +New-Alias which get-command + +# Bash functionality + +function touch ($name) { + New-Item -Path . -Name $name +} + +function WingetRun { + param ( + [string]$packageName + ) + + Start-Process microsoft-edge:https://winget.run/search?query=$packageName +} + +Set-Alias -name touch -Value TouchFile + +# Azure handy + +# Containers + +function KUp($name) { + $m = kubectl get deployments --all-namespaces | Select-String -Pattern $name -SimpleMatch -NoEmphasis | Out-String | % { $_.split(" ")[0] } + $n = $m.Substring(2) + + kubectl scale deployments -n $n --replicas=1 --all +} + +function KDown($name) { + $m = kubectl get deployments --all-namespaces | Select-String -Pattern $name -SimpleMatch -NoEmphasis | Out-String | % { $_.split(" ")[0] } + $n = $m.Substring(2) + + kubectl scale deployments -n $n --replicas=0 --all +} + +function KRe($name) { + $m = kubectl get deployments --all-namespaces | Select-String -Pattern $name -SimpleMatch -NoEmphasis | Out-String | % { $_.split(" ")[0] } + $n = $m.Substring(2) + + kubectl scale deployments -n $n --replicas=0 --all + kubectl scale deployments -n $n --replicas=1 --all +} + +function KCon($con) { + $o = "sdpaks-$con-k8s" + kubectl config use-context $o + + if ($?) { + Write-host "Currently in " -NoNewline + Write-Host $con -ForegroundColor Green -NoNewline + Write-Host " cluster" -ForegroundColor Yellow + } +} + +function KNs($name) { + # always returns true.. nneed workaround + kubectl config set-context --current --namespace=$name + if ($?) { + $con = kubectl config current-context + Write-host "Currently at " -NoNewline -ForegroundColor Yellow + Write-Host $name -ForegroundColor Cyan -NoNewline + Write-Host " namespace in " -ForegroundColor Yellow -NoNewline + Write-Host $con -ForegroundColor Green -NoNewline + Write-Host " cluster" -ForegroundColor Yellow + } +} + + +function dup() { + [CmdletBinding()] + param ( + [string] $name + ) + docker-compose up $name -d +} + +Set-Alias doup docup + +function ddown() { + [CmdletBinding()] + param ( + [string] $name + ) + docker-compose down $name +} + +function kexec() { + [CmdletBinding()] + param ( + [string] $name + ) + try { + kubectl exec -it $name bash + } + catch { + kubectl exec -it $name sh + } +} + +function FSync() { + fluxctl.exe sync --k8s-fwd-ns flux +} + +# General bash-style aliases + +function New-BashStyleAlias([string]$name, [string]$command) { + $sb = [scriptblock]::Create($command) + New-Item "Function:\global:$name" -Value $sb -Force | Out-Null +} + +# Quick Folder movement +New-BashStyleAlias .. 'cd ..' +New-BashStyleAlias ... "cd ../../" +New-BashStyleAlias .... "cd ../../../" +New-BashStyleAlias ..... "cd ../../../../" +New-BashStyleAlias cl "cd $$" # cd to last argument of previous folder + +# Git commands +New-BashStyleAlias log "git log --oneline" +New-BashStyleAlias gdiff "git diff" +New-BashStyleAlias branch "git branch -a" +New-BashStyleAlias status "git status" +New-BashStyleAlias stash "git stash" +New-BashStyleAlias pop "git stash pop" +New-BashStyleAlias reset "git reset --soft" +New-BashStyleAlias fetch "git fetch" +New-BashStyleAlias push "git push origin head" +New-BashStyleAlias pull "git pull" +New-BashStyleAlias recent "git for-each-ref --sort -committerdate refs/heads/" +New-BashStyleAlias glog "git log --graph --pretty --oneline --abbrev-commit --decorate" + +# CD to Specific folders +New-BashStyleAlias home 'cd ~' +New-BashStyleAlias appl 'cd c:/appl' +New-BashStyleAlias repos 'cd c:/appl/repos' +New-BashStyleAlias path 'cd c:/appl/path' +New-BashStyleAlias certs 'cd c:/appl/certs' +New-BashStyleAlias dotfiles 'cd c:/appl/repos/dotfiles' + +# Speical commands + +New-BashStyleAlias prev "Get-Content (Get-PSReadlineOption).HistorySavePath" + +function Authenticate-Databricks { + $env:DATABRICKS_AAD_TOKEN = (az account get-access-token --resource 2ff814a6-3304-4ab8-85cb-cd0e6f879c1d) | convertfrom-json | Select-Object accessToken -ExpandProperty accessToken + databricks configure --host https://xxx.azuredatabricks.net --aad-token --jobs-api-version 2.1 +} + + +function reset() { + [CmdletBinding()] + param ( + [Parameter(ParameterSetName = "Default", Position = 0)] + $Mode = "soft" + ) + $branch = (git rev-parse --abbrev-ref HEAD) + git reset --$Mode origin/$branch + git restore --staged . + status +} + +function gcom() { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true, ParameterSetName = "Default", Position = 0)] + [string] $message + ) + git commit -m $message +} + +set-alias gcmon gcom +set-alias com gcom + +function gadd() { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true, ParameterSetName = "Default", Position = 0)] + [string] $name + ) + git add $name + git status +} + +set-alias add gadd + +function gaddcom() { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true, ParameterSetName = "Default", Position = 0)] + [string] $Name, + [Parameter(Mandatory = $true, ParameterSetName = "Default", Position = 1)] + [string] $Message + ) + git add $Name + git commit -m $Message + git --no-pager log --pretty=oneline -n3 --oneline +} + +set-alias acom gaddcom + +function reset() { + [CmdletBinding()] + param ( + [Parameter(ParameterSetName = "Mode", Position = 0)] + $Mode = "soft" + ) + $branch = (git rev-parse --abbrev-ref HEAD) + git reset --$Mode origin/$branch + git restore --staged . + " `r`n " + git --no-pager log --pretty=oneline -n3 --oneline + " `r`n " + status +} + +function merge() { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true, ParameterSetName = "Default", Position = 0)] + [string] $Name + ) + git merge $Name +} + +function clone() { + [CmdletBinding()] + param ( + [Parameter(Mandatory = $true, ParameterSetName = "Default", Position = 0)] + [string] $Name + ) + git clone $Name +} + +# Open current repo and branch on Github +function remote() { + + [CmdletBinding()] + param ( + [Parameter(Mandatory = $false, ParameterSetName = "Default", Position = 0)] + [switch] $Repo, + [Parameter(Mandatory = $false, ParameterSetName = "Default", Position = 1)] + [switch] $LastCommit + ) + + $rawurl = git remote get-url --all origin + + if ($rawurl -like "*.git") { + $url = $rawurl.Substring(0, $rawurl.lastIndexOf('.')) + + } + else { + $url = $rawurl + } + + $branch = git rev-parse --abbrev-ref HEAD + $head = git rev-parse --short HEAD + + if ($Repo) { $1 = "$url/tree/$branch" } + $2 = "$url/commits/$branch" + if ($LastCommit) { $3 = "$url/commit/$head" } + + Start-Process chrome.exe $1, $2, $3 +} + +## Git branch switching +New-BashStyleAlias master "git checkout master" +New-BashStyleAlias main "git checkout main" +New-BashStyleAlias mainp "git checkout main && pull" +New-BashStyleAlias prod "git checkout production" +New-BashStyleAlias prodp "git checkout production && pull" +New-BashStyleAlias dev "git checkout dev" +New-BashStyleAlias production "git checkout production" +New-BashStyleAlias development "git checkout development" + +# Others +New-BashStyleAlias editgit "code %homepath%/.gitconfig" # ~ not working +New-BashStyleAlias editbash "code %homepath%/.bashrc" +New-BashStyleAlias editzsh "code %homepath%/.zshrc" +New-BashStyleAlias editba "code %homepath%/.bash_aliases" +New-BashStyleAlias np "cmd.exe /c notepad" + +#Testing / remote inspiration +# "Some functions copied from github users @devblackops @scrthq and @timsneath + +# Find out if the current user identity is elevated (has admin rights) + +$identity = [Security.Principal.WindowsIdentity]::GetCurrent() +$principal = New-Object Security.Principal.WindowsPrincipal $identity +$isAdmin = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) + + +$Host.UI.RawUI.WindowTitle = "PowerShell {0}" -f $PSVersionTable.PSVersion.Major.ToString() +if ($isAdmin) { + $Host.UI.RawUI.WindowTitle += " [ADMIN]" +} + +function dirs { + if ($args.Count -gt 0) { + Get-ChildItem -Recurse -Include "$args" | Foreach-Object FullName + } + else { + Get-ChildItem -Recurse | Foreach-Object FullName + } +} + +function cc { + + Invoke-History | Set-Clipboard + +} + +# Forward docker and docker-compose from WSL to Windows. Which exact index needs to be split may vary based on your distro and even local machine. +$ifconfig = wsl ifconfig eth0 +$env:DOCKER_HOST = $ifconfig[1].Split(" ")[9] + +function dockerd { + wsl sudo dockerd -H $env:DOCKER_HOST +} + +function pkill { wsl sudo pkill $args } + +function docker-compose { wsl docker-compose -H $env:DOCKER_HOST $args } +function docker { wsl docker -H $env:DOCKER_HOST $args } + +Set-Alias d docker +Set-Alias doc docker-compose \ No newline at end of file diff --git a/startup/raw/terminal/settings.json b/startup/raw/terminal/settings.json new file mode 100644 index 0000000..c52b722 --- /dev/null +++ b/startup/raw/terminal/settings.json @@ -0,0 +1,159 @@ +// eq - %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json + + +// To view the default settings, hold "alt" while clicking on the "Settings" button. +// For documentation on these settings, see: https://aka.ms/terminal-documentation + +{ + "$schema": "https://aka.ms/terminal-profiles-schema", + + "defaultProfile": "{b091671b-cbd8-4bf4-86e8-55f57173be34}", + "initialCols": 128, + "initialRows": 38, + "windowRestoreMode": "lastPositionAndSize", + "useTabSwitcher": true, + + // Selection + "copyOnSelect": false, + "copyFormatting": true, + "wordDelimiters": " /\\()\"'-.,:;<>~!@#$%^&*|+=[]{}~?\u2502", + + "profiles": [ + + { + "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", + // Make changes here to the pwsh.exe profile + "acrylicOpacity": 1, + //"useAcrylic": true, + "background": "#000000", + "backgroundImage": "C:\\Appl\\Repos\\dotfiles\\startup\\img\\pwsh.jpg", + "backgroundImageOpacity": 0.17, + "backgroundImageStechMode": "uniformToFill", + "colorScheme": "Campbell", + "cursorHeight": 25, + "fontFace": "LiterationMono NF", + "fontSize": 15, + "icon": "ms-appdata:///roaming/pwsh-32.png", + "name": "PowerShell 7.x", + "padding": "10, 10, 0, 10", + "hidden": false, + "startingDirectory": "c:/appl/repos", + "source": "Windows.Terminal.PowershellCore" + }, + { + "guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}", + "hidden": true // hide bugged ubuntu 18.04 + }, + { + "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", + "hidden": true // hide CMD + }, + { + "guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", + "hidden": true // hide azure cloud shell + }, + { + "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", + "hidden": true // hide windows powershell + }, + { + "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", + "hidden": false, + "name": "Ubuntu-20.04", + "source": "Windows.Terminal.Wsl", + // Make changes here to the wsl.exe profile + "acrylicOpacity": 1, + //"useAcrylic": true, + "backgroundImage": "C:\\Appl\\Repos\\dotfiles\\startup\\img\\linux.jpg", + "backgroundImageOpacity": 0.17, + "backgroundImageStechMode": "uniformToFill", + "padding": "10, 10, 0, 10", + "startingDirectory": "/mnt/c/Appl/repos", + "colorScheme": "Campbell", + "cursorHeight": 25, + "fontFace": "mesloLGS NF", + "fontSize": 15 + }, + + { + "guid": "{b091671b-cbd8-4bf4-86e8-55f57173be34}", + "background": "#000000", + "backgroundImage": "C:\\Appl\\Repos\\dotfiles\\startup\\img\\pwsh.jpg", + "backgroundImageOpacity": 0.17, + "commandline": "C:\\Program Files\\PowerShell\\7-preview\\pwsh.exe", + "icon": "ms-appx:///ProfileIcons/pwsh-preview.png", + "name": "PowerShell 7 Preview", + "padding": "10, 10, 0, 10", + "hidden": false, + "startingDirectory": "c:/appl/repos", + "colorScheme": "Campbell", + "cursorHeight": 25, + "fontFace": "LiterationMono NF", + "fontSize": 15, + } + ], + + // Add custom color schemes to this array + "schemes": [], + + // Add any keybinding overrides to this array. + // To unbind a default keybinding, set the command to "unbound" + "keybindings": [ + + // Settings + { "command": "openSettings", "keys": "ctrl+," }, + { "command": "commandPalette", "keys": "ctrl+shift+p" }, + { "command": "toggleFocusMode", "keys": "alt+f" }, + { "command": { "action": "setTabColor", "color": "#ffffff" }, "keys": "ctrl+a" }, + { "command": "toggleRetroEffect", "keys": "ctrl+d" }, + + // Tabs general + { "command": "newTab", "keys": "ctrl+t" }, + { "command": "closePane", "keys": "ctrl+w" }, + { "command": "nextTab", "keys": "ctrl+tab" }, + { "command": "prevTab", "keys": "ctrl+shift+tab" }, + + // Tab switches + { "command": { "action": "switchToTab", "index": 0 }, "keys": "ctrl+1" }, + { "command": { "action": "switchToTab", "index": 1 }, "keys": "ctrl+2" }, + { "command": { "action": "switchToTab", "index": 2 }, "keys": "ctrl+3" }, + { "command": { "action": "switchToTab", "index": 3 }, "keys": "ctrl+4" }, + { "command": { "action": "switchToTab", "index": 4 }, "keys": "ctrl+5" }, + { "command": { "action": "switchToTab", "index": 5 }, "keys": "ctrl+6" }, + { "command": { "action": "switchToTab", "index": 6 }, "keys": "ctrl+7" }, + { "command": { "action": "switchToTab", "index": 7 }, "keys": "ctrl+8" }, + { "command": { "action": "switchToTab", "index": 8 }, "keys": "ctrl+9" }, + + // Clipboard Integration + { "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+shift+c" }, + { "command": { "action": "copy", "singleLine": false }, "keys": "ctrl+insert" }, + { "command": "paste", "keys": "ctrl+shift+v" }, + { "command": "paste", "keys": "shift+insert" }, + + // Split + { "command": { "action": "splitPane", "split": "horizontal" }, "keys": "alt+shift+up" }, + { "command": { "action": "splitPane", "split": "vertical" }, "keys": "alt+shift+right" }, + { "command": { "action": "splitPane", "split": "horizontal" }, "keys": "alt+shift+down" }, + { "command": { "action": "splitPane", "split": "vertical" }, "keys": "alt+shift+left" }, + + // Scrollback + { "command": "scrollDown", "keys": "shift+down" }, + { "command": "scrollDownPage", "keys": "pgdn" }, + { "command": "scrollUp", "keys": "shift+up" }, + { "command": "scrollUpPage", "keys": "pgup" }, + + // Focus + { "command": { "action": "moveFocus", "direction": "down" }, "keys": "alt+down" }, + { "command": { "action": "moveFocus", "direction": "left" }, "keys": "alt+left" }, + { "command": { "action": "moveFocus", "direction": "right" }, "keys": "alt+right" }, + { "command": { "action": "moveFocus", "direction": "up" }, "keys": "alt+up" }, + + // Resize pane + { "command": { "action": "resizePane", "direction": "down" }, "keys": "ctrl+shift+down" }, + { "command": { "action": "resizePane", "direction": "left" }, "keys": "ctrl+shift+left" }, + { "command": { "action": "resizePane", "direction": "right" }, "keys": "ctrl+shift+right" }, + { "command": { "action": "resizePane", "direction": "up" }, "keys": "ctrl+shift+up" } + + ] + } + \ No newline at end of file diff --git a/startup/raw/windowmanager.ahk b/startup/raw/windowmanager.ahk new file mode 100644 index 0000000..4253d0c --- /dev/null +++ b/startup/raw/windowmanager.ahk @@ -0,0 +1,36 @@ +;Startup script for starting up two virtual desktops and placing Windows +#SingleInstance force + +; Open apps in work desktop +Run code +WinMaximize +WinMove, 1920, 0 ; Code on left monitor +Run chrome.exe google.com portal.azure.com https://github.com/equinor/sdp-flux/tree/dev git.equinor.com https://stackoverflow.com/search?q= youtube.com +WinMove, 3840, 0 ; Chrome on right monitor + +Run wt `; new-tab -p "pwsh" -d C:\appl; new-tab -p "pwsh" -d C:\appl; new-tab -p "Bash"; new-tab -p "Bash"; new-tab -p "Bash"; focus-tab -t 0 +WinMove, 0, 0 ; Terminal on laptop screen (left) +Sleep 10000 + +Process, Wait, code.exe +WinMaximize + +;switch to next virtual desktop +Send ^#{Right} + +; Opening apps on communication desktop + +run outlook.exe +Run slack:// +run lync.exe ; Skype for Business +Process, Wait, outlook.exe +WinMaximize + +Sleep 9000 + +;switch to default virtual desktop +Send ^#{Left} + +Send ^#{Left} +Process, Close, cmd.exe +Process, Close, conhost.exe \ No newline at end of file diff --git a/startup/raw/winget/settings.json b/startup/raw/winget/settings.json new file mode 100644 index 0000000..2ebb9e2 --- /dev/null +++ b/startup/raw/winget/settings.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://aka.ms/winget-settings.schema.json", + + "experimentalFeatures": { + "experimentalCmd": true, + "experimentalArg": true, + "list": true, + "upgrade": true + }, +} \ No newline at end of file diff --git a/startup/script/boot.cmd b/startup/script/boot.cmd new file mode 100644 index 0000000..10484ed --- /dev/null +++ b/startup/script/boot.cmd @@ -0,0 +1,10 @@ +cd C:\appl\repos\dotfiles +git pull + +copy ".\startup\raw\keybinds.ahk" "%USERPROFILE%\Start Menu\Programs\Startup" /Y +copy ".\startup\raw\windowmanager.ahk" "%USERPROFILE%\Start Menu\Programs\Startup" /Y + +copy ".\startup\raw\profile.ps1" "C:\Program Files\PowerShell\7\Profile.ps1" /Y +copy ".\startup\raw\settings.json" "%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" /Y + +exit \ No newline at end of file diff --git a/startup/script/homeboot.cmd b/startup/script/homeboot.cmd new file mode 100644 index 0000000..7977d6d --- /dev/null +++ b/startup/script/homeboot.cmd @@ -0,0 +1,8 @@ +cd C:\appl\repos\dotfiles +git pull + +copy ".\startup\raw\keybinds.ahk" "%USERPROFILE%\Start Menu\Programs\Startup" /Y + +copy ".\startup\raw\profile.ps1" "C:\Program Files\PowerShell\7\Profile.ps1" /Y +copy ".\startup\raw\terminal\settings.json" "%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" /Y + diff --git a/trash b/trash deleted file mode 100644 index f74ba8a..0000000 --- a/trash +++ /dev/null @@ -1,49 +0,0 @@ -printf "\n php Version: (Type 72 for php7.2, type 7.1 for php7.1 or 56 for php5.6 or 'n' to escape): " -read -r phpv -if [ -z "${phpv}" ]; then - phpv=72 - printf "php7.2" -elif [ "${phpv}" == 7.1 ] || [ "${phpv}" == 71 ]; then - phpv=71 - printf "php7.1" -elif [ "${phpv}" == 5.6 ] || [ "${phpv}" == 56 ]; then - phpv=56 - printf "php7.1" -else - phpv=false -fi -if [ ! "${phpv}" == false ]; then - printf "\n Install Laravel (Y/n): " - read -r laravel - if [ -z "${laravel}" ] || [ "${laravel}" == Y ] || [ "${laravel}" == y ]; then - laravel=true - else - laravel=false - fi - printf "\n Install php Composer (Y/n): " - read -r phpcomposer - if [ -z "${phpcomposer}" ] || [ "${phpcomposer}" == Y ] || [ "${phpcomposer}" == y ]; then - phpcomposer=true - else - phpcomposer=false - fi -else - laravel=false - phpcomposer=false -fi - -trap '' 2 # Signal 2 is Control-C, now disabled. - command - command - command - trap 2 # Reenables Control-C - -git clone https://github.com/molovo/lumberjack - lumberjack/lj /usr/local/bin - -lj --file /usr/local/var/log/myawesomescript.log --level critical -emergency, alert, critical, error, warning, notice, info or debug -lj critical ‘Something went wrong’ -lj 'This is a notice' - -command && command-to-execute-on-success || command-to-execute-on-failure