Skip to content

Instantly share code, notes, and snippets.

View julianstephens's full-sized avatar

Julian Stephens julianstephens

View GitHub Profile
@WillPresley
WillPresley / wsl-backup-and-compress.ps1
Last active March 22, 2024 16:38
Backup WSL2 Virtual Disks and Compress with 7-Zip
# Backup WSL2 virtual disks using native functions and compress them using 7zip
## Will Presley, 2020
## willpresley.com
#### http://mats.gardstad.se/matscodemix/2009/02/05/calling-7-zip-from-powershell/
# Alias for 7-zip
if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) {throw "$env:ProgramFiles\7-Zip\7z.exe needed"}
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
#### Alternative native PS 7-zip: https://www.sans.org/blog/powershell-7-zip-module-versus-compress-archive-with-encryption/
@zhensongren
zhensongren / install_mysql_in_wsl.md
Last active March 11, 2024 16:59
Set up MySQL on local machine (Windows Subsystem for Linux, WSL2)

Upgrade the Repositories

sudo apt update sudo apt upgrade

Install MySQL 5.7

sudo apt install mysql-server

Secure MySQL Installation

sudo apt install mysql-server #To do the high security provide all answers to yes

@TonyFrancis
TonyFrancis / MultiTenantFlask.py
Created May 18, 2017 04:48
Creating multi Tenant system with multiple Database. Switching between databases based on subdomain related to tenant
from functools import wraps
from flask import Flask, g, session, request, abort, jsonify
from flask_migrate import MigrateCommand, Migrate
from flask_script import Manager
from flask_sqlalchemy import SQLAlchemy
flask_app = Flask(__name__, static_folder='./static')
db = SQLAlchemy()
migrate = Migrate()
@jlavelle
jlavelle / flask_sqlalchemy_secondary_db_reflection.py
Last active July 26, 2018 19:58
An example of configuring a Flask-SQLAlchemy session for a relfected Table object from a legacy database.
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import MetaData, Table
app = Flask()
db = SQLAlchemy()
db.init_app(app)
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_1_URI')
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000