Skip to content

Instantly share code, notes, and snippets.

View mzaglia's full-sized avatar

Matheus C. Zaglia mzaglia

  • Geopixel
  • São José dos Campos, SP - Brazil
View GitHub Profile
@mzaglia
mzaglia / GdalJava.md
Created April 24, 2024 12:24
GDAL 3.5.3 with Java Bindings

Download and compile GDAL

apt-get install -y build-essential wget cmake swig ant libgeos-dev libproj-dev proj-data proj-bin swig libkml-dev libxml2-dev libsqlite3-dev libspatialite-dev openjdk-8-jdk
# clone gdal
wget -N https://github.com/OSGeo/gdal/releases/download/v3.5.3/gdal-3.5.3.tar.gz
tar -xzf gdal-3.5.3.tar.gz
cd gdal-3.5.3
mkdir build && cd build
cmake .. -DBUILD_JAVA_BINDINGS=ON -DBUILD_PYTHON_BINDINGS=OFF -DCMAKE_INSTALL_PREFIX=/usr
cmake --build . --target install -- -j8
@mzaglia
mzaglia / autoYoutubeTheater.md
Last active April 1, 2024 13:26
Youtube auto theater mode

Open devtools and paste the following in the console:

document.cookie = 'wide=1; expires='+new Date('3099').toUTCString()+'; path=/';
@mzaglia
mzaglia / portainer.conf
Created June 6, 2022 20:33
Portainer subpath NGINX
upstream portainer {
server 127.0.0.1:9000;
}
server {
listen 80;
location /portainer/ {
proxy_http_version 1.1;
proxy_set_header Connection "";
@mzaglia
mzaglia / wsl2_no_internet.ps1
Created May 1, 2021 13:42
WSL2 No internet
echo "Restarting WSL Service"
Restart-Service LxssManager
echo "Restarting Host Network Service"
Stop-Service -name "hns"
Start-Service -name "hns"
echo "Restarting Hyper-V adapters"
Get-NetAdapter -IncludeHidden | Where-Object `
{$_.InterfaceDescription.StartsWith('Hyper-V Virtual Switch Extension Adapter')} `
| Disable-NetAdapter -Confirm:$False
Get-NetAdapter -IncludeHidden | Where-Object `
@mzaglia
mzaglia / hyper-v-static-ip.md
Last active March 7, 2024 09:02
Static IP Hyper-V Ubuntu VM

First in a powershell create a new network switch

New-VMSwitch -SwitchName "SwitchName" -SwitchType Internal
Get-NetAdapter       // (note down ifIndex of the newly created switch as INDEX)
New-NetIPAddress -IPAddress 192.168.0.1 -PrefixLength 24 -InterfaceIndex <INDEX>
New-NetNat -Name MyNATnetwork -InternalIPInterfaceAddressPrefix 192.168.0.0/24

In your ubuntu server open your network netplan

@mzaglia
mzaglia / wsl_vhdx.md
Last active August 16, 2021 04:45
WSL Change vhdx
  1. Backup current vhdx file from %LOCALAPPDATA%\Packages\<PackageFamilyName>\LocalState\ext4.vhdx to D:\ext4.vhdx (Most important step. If you can't find correct vhdx file, you shouldn't go ahead)
  2. Remove current distro, like wsl --unregister Ubuntu-20.04
  3. Reinstall distro from Microsoft Store
  4. Export and import wsl --export Ubuntu-20.04 D:\wsl.tar
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mzaglia
mzaglia / app.py
Created March 23, 2020 15:08
werkzeug HTTPExceptions as JSON
from flask import Flask
from werkzeug.exceptions import HTTPException
app = Flask(__name__)
@app.errorhandler(HTTPException)
def http_exception_handler(e):
return {'code': e.code, 'description': e.description}
if __name__ == '__main__':
@mzaglia
mzaglia / spotifyshortcuts.khotkey
Created February 21, 2020 13:01
Spotify media shortcuts for KDE
[Data]
DataCount=1
[Data_1]
Comment=should never see
DataCount=4
Enabled=true
Name=should never see
SystemGroup=2
Type=ACTION_DATA_GROUP
@mzaglia
mzaglia / ssh_config
Created December 5, 2018 16:38
Keep ssh connection alive
Host *
ServerAliveInterval 120
ServerAliveCountMax 30
ConnectTimeout 30