Skip to content

Instantly share code, notes, and snippets.

View brettjrea's full-sized avatar
:electron:
Live for Love! Love for Life!

Brett Rea brettjrea

:electron:
Live for Love! Love for Life!
  • Long Island, NY
View GitHub Profile
@brettjrea
brettjrea / install-nvm.sh
Last active March 19, 2023 03:29
This shell script sets up a Node.js development environment on your Linux machine by installing nvm, the Node Version Manager, and the latest LTS (long-term support) version of Node.js. The script also updates and upgrades packages, removes unused packages, and installs curl for downloading files from the internet. Use this script to quickly and…
#!/bin/bash
# update and upgrade packages
sudo apt update -y && sudo apt upgrade -y
# remove unused packages
sudo apt autoremove -y
# install curl
sudo apt install curl -y
@brettjrea
brettjrea / ubuntu-jammy-upgrade-script.sh
Last active March 19, 2023 03:29
This shell script updates and upgrades a Ubuntu-based Linux system to the latest release using the apt package manager. The script sets the update manager to check for long-term support (LTS) releases, changes the current release from Focal to Jammy, and performs the necessary package updates and upgrades. Use this script to upgrade your Ubuntu-…
#!/bin/bash
### Disable Prompts.
export DEBIAN_FRONTEND=noninteractive
###Update & Upgrade.
apt update -y && apt dist-upgrade -y
###Configure available releases to LTS.
sed -i 's/Prompt=lts/Prompt=normal/g' /etc/update-manager/release-upgrades
###Change from Focal to Jammy.
sed -i 's/focal/jammy/g' /etc/apt/sources.list
apt update -y
@brettjrea
brettjrea / install-vsc-remote-pack.ps1
Last active March 19, 2023 00:32
This PowerShell script installs Visual Studio Code and the Remote Development extension pack on Windows. Note that it needs to be run twice due to a limitation in the VS Code CLI that prevents it from installing extension packs during the initial installation. To do this, simply run the script again after the first installation completes. Use th…
# Install VS Code
$vscodeInstaller = "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-user"
$vscodeInstallerPath = "$env:TEMP\vscode_installer.exe"
Invoke-WebRequest -Uri $vscodeInstaller -OutFile $vscodeInstallerPath
Start-Process -FilePath $vscodeInstallerPath -ArgumentList "/VERYSILENT /NORESTART /SUPPRESSMSGBOXES" -Wait
# Install Remote Development (extension pack)
$remoteDevelopmentExtensionPack = "ms-vscode-remote.vscode-remote-extensionpack"
code --install-extension $remoteDevelopmentExtensionPack
# Step 1: Open Windows Powershell from powerusers menu
Start-Process powershell -Verb runAs
# Step 2: Enable Windows Optional Feature Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Write-Host "Windows Optional Feature Microsoft-Windows-Subsystem-Linux is enabled."
# Enable Hyper-V
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
wsl --set-default-version 2
@brettjrea
brettjrea / debian-bullseye-upgrade-script.sh
Last active March 19, 2023 03:31
This shell script updates and upgrades a Debian-based Linux system to the latest release using the apt package manager. The script sets the update manager to check for long-term support (LTS) releases, changes the current release from Buster to Bullseye, and performs the necessary package updates and upgrades. Use this script to upgrade your Deb…
#!/bin/bash
### Disable Prompts.
export DEBIAN_FRONTEND=noninteractive
###Update & Upgrade.
apt update -y && apt dist-upgrade -y
###Configure available releases to LTS.
sed -i 's/Prompt=lts/Prompt=normal/g' /etc/update-manager/release-upgrades
###Change from Buster to Bullseye.
sed -i 's/buster/bullseye/g' /etc/apt/sources.list
apt update -y
@brettjrea
brettjrea / git diff --no-index file1 file2 > diff.txt
Last active March 19, 2023 03:32
This shell script generates a diff file between two files using the git diff command and saves the output to a file named diff.txt. The git diff command compares the contents of the two files and generates a unified diff format that shows the differences between them. Use this script to generate a diff file that you can use for version control, …
git diff --no-index file1 file2 > diff.txt
@brettjrea
brettjrea / javadoc -d -ignore-source-errors
Last active March 19, 2023 03:33
This shell script generates Java documentation using the javadoc command and saves the output to the specified output directory. The javadoc command generates HTML documentation from Java source code and Javadoc comments. The --ignore-source-errors option allows the command to continue generating documentation even if there are errors in the sou…
javadoc --ignore-source-errors -d [output path] [input path]
@brettjrea
brettjrea / Dockerfile
Last active March 19, 2023 03:36
This is a Dockerfile for building a development container for Java applications in Visual Studio Code. It uses the mcr.microsoft.com/vscode/devcontainers/java base image and allows for choosing a specific Java version, Maven and/or Gradle installation, and Node.js version. Additional OS packages and global Node.js packages can be installed by un…
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/java/.devcontainer/base.Dockerfile
# [Choice] Java version (use -bullseye variants on local arm64/Apple Silicon): 11, 17, 11-bullseye, 17-bullseye, 11-buster, 17-buster
ARG VARIANT="17-bullseye"
FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT}
# [Option] Install Maven
ARG INSTALL_MAVEN="false"
ARG MAVEN_VERSION=""
# [Option] Install Gradle
@brettjrea
brettjrea / devcontainer.json
Last active March 19, 2023 03:39
This is a JSON configuration file for creating a Java development container in Visual Studio Code using Docker. The configuration includes options for choosing a Java version and specifying OS versions. #Java #Docker #VSCode #JSON #Configuration
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/java
{
"name": "Java",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a Java version: 11, 17
// Append -bullseye or -buster to pin to an OS version.
// Use the -bullseye variants on local arm64/Apple Silicon.
@brettjrea
brettjrea / b2b.md
Last active March 19, 2023 03:44
This script upgrades a Debian Bullseye system to the latest version and fixes common issues with shell scripts. It runs the fixscripts.sh and upgrade.sh scripts, installs wget and performs necessary system cleanup. Use the -y flag to accept all prompts during the upgrade process. #Debian #Bullseye #upgrade #shellscripts