Skip to content

Instantly share code, notes, and snippets.

@musukvl
musukvl / add-migration-and-update-db.bat
Created December 26, 2020 15:07
Add Migration and update db EF Core
View add-migration-and-update-db.bat
dotnet ef migrations add InitialCreate --context WaypointDbPgSqlContext --output-dir Migrations/pgSql -- Host=localhost;Username=postgres;Password=admin123;Database=waypoint_db
dotnet ef database update --context WaypointDbPgSqlContext --connection "Host=localhost;Username=postgres;Password=admin123;Database=waypoint_db"
@musukvl
musukvl / remove-docker-stuff.ps1
Created December 24, 2020 21:33
Remove docker images and containers
View remove-docker-stuff.ps1
docker ps -a -q | % { docker rm $_ }
docker images -q | % { docker rmi $_ }
@musukvl
musukvl / install-open-media-vault-raspi4.sh
Created December 12, 2020 21:06
Install OpenMediaVault to RaspberryPi 4
View install-open-media-vault-raspi4.sh
# force ip4 to avoid problems with ip v6 connections during apt-get update
echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
# run openmediavuault scripts
wget -O - https://github.com/OpenMediaVault-Plugin-Developers/installScript/raw/master/install | sudo bash
@musukvl
musukvl / powershell-script-output-to-cli-and-file.cmd
Last active November 25, 2020 12:43
Execute powershell script in CMD and write output to console and commandline
View powershell-script-output-to-cli-and-file.cmd
powershell -Command "&'./myscript.ps1' -myscriptparam | tee -FilePath myscriptoutput.log"
@musukvl
musukvl / antivirus-exclusions.ps1
Created November 21, 2020 20:56
Displays folders excluded from antivirus
View antivirus-exclusions.ps1
$WDAVprefs = Get-MpPreference
#$WDAVprefs.ExclusionExtension
$WDAVprefs.ExclusionPath
@musukvl
musukvl / replace-in-files.ps1
Created November 4, 2020 21:27
PowerShell: Replace text in multiple files
View replace-in-files.ps1
ls ./SqlScripts/*.sql | %{$f = $_; (gc $f.PSPath) | %{$_ -replace "SET @ENV = ''", "SET @ENV = 'TEST'"} | sc $f.PSPath }
@musukvl
musukvl / get-ovpn-config.bat
Created September 4, 2020 21:12
Start VPN server on ubuntu and download client configuration
View get-ovpn-config.bat
set VPS_PUBLIC_IP=1.2.3.4
ssh ary@%VPS_PUBLIC_IP% "wget -O - https://gist.githubusercontent.com/musukvl/63367edcc9ae643baf1aac4a348a6828/raw/ac2a2194af647f82edc78febd40d205dd4e7c12e/install-vpn.sh | bash"
scp ary@%VPS_PUBLIC_IP%:/home/ary/vpn/openvpn_conf/client.ovpn .
@musukvl
musukvl / install-vpn.sh
Last active September 4, 2020 20:37
Installing VPN to VM
View install-vpn.sh
#!/bin/sh
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
mc \
gnupg-agent \
@musukvl
musukvl / install-dotnet.sh
Created September 1, 2020 06:32
ubuntu 20: install dotnet core sdk
View install-dotnet.sh
#!/bin/sh
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y apt-transport-https
sudo apt-get update
sudo apt-get install -y dotnet-sdk-3.1
@musukvl
musukvl / install-docker.sh
Last active September 1, 2020 15:56
install docker ubuntu 20
View install-docker.sh
#!/bin/sh
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common