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 / jupyterhub_docker.txt
Created October 25, 2017 18:45
Installing Docker, JupyterHub and creating a custom Jupyter Notebook Image
###### DOCKER ######
# Remove old version of docker
sudo apt-get remove docker docker-engine docker.io
# Allow apt install from HTTPS
sudo apt-get update && \
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
@mzaglia
mzaglia / gcd_clojure.clj
Created March 15, 2018 14:45
gcd_clojure created by mzaglia - https://repl.it/@mzaglia/gcdclojure
(defn gcd [value1 value2]
(if (zero? value2)
value1
(recur value2 (mod value1 value2))))
(gcd 150 20)
@mzaglia
mzaglia / gcd_rust.rs
Created March 15, 2018 16:54
gcd_rust created by mzaglia - https://repl.it/@mzaglia/gcdrust
fn gcd_rec(value1: i32, value2: i32) -> i32
{
if value2 == 0
{
return value1;
}
return gcd_rec(value2, (value1 % value2));
}
fn gcd(mut value1: i32,mut value2: i32) -> i32
# -*- coding: utf-8 -*-
from sympy import *
init_printing()
def lagrange(matrix):
size = len(matrix)
x = Symbol('x')
a = 0
for k in range(0, size):
@mzaglia
mzaglia / ssh_config
Created December 5, 2018 16:38
Keep ssh connection alive
Host *
ServerAliveInterval 120
ServerAliveCountMax 30
ConnectTimeout 30
@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 / 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__':
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@mzaglia
mzaglia / hyper-v-static-ip.md
Last active July 20, 2024 05:48
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