Skip to content

Instantly share code, notes, and snippets.

@ligz08
ligz08 / gitconfig.sh
Last active April 26, 2023 20:58
Git global configs
git config --global alias.s status
git config --global alias.b branch
git config --global alias.db 'branch -d'
git config --global alias.ddb 'branch -D'
git config --global alias.fch fetch
git config --global alias.co checkout
git config --global alias.mg merge
git config --global alias.cmt commit
git config --global alias.l 'log --oneline --graph'
git config --global alias.la 'log --oneline --graph --all'
@ligz08
ligz08 / Confirm-SparkReadyOnWindows.ps1
Last active August 16, 2018 19:28
Spark ready-to-go on Windows checklist.
# Check JAVA_HOME
$null -ne $env:JAVA_HOME
Test-Path $env:JAVA_HOME
-not ($env:JAVA_HOME -match '\s+')
# Check java.exe
Test-Path $env:JAVA_HOME\bin\java.exe
# Check javac.exe
Test-Path $env:JAVA_HOME\bin\javac.exe
@ligz08
ligz08 / Add-OpenWithSublimeText3.ps1
Last active July 19, 2018 03:14
Add/remove "Open with Sublime Text 3" option in Windows File Explorer right-click menu, with PowerShell. Tested on Windows 10 and PowerShell 5.1.
#Requires -RunAsAdministrator
$menutext = "Open with Sublime Text 3"
$sublime = "C:\Program Files\Sublime Text 3\sublime_text.exe"
$for_files = "Registry::HKEY_CLASSES_ROOT\*\shell\$menutext"
$for_dirs = "Registry::HKEY_CLASSES_ROOT\Directory\shell\$menutext"
$for_background = "Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\$menutext"
foreach ($path in @($for_files, $for_dirs, $for_background)){
$placeholder = if ($path -eq $for_files) {"%1"} else {"%V"}
# Python & Jupyter Notebook
*.pyc
.ipynb_checkpoints/
__pycache__/
# ArcGIS
*.gdb
*.lock
# Shapefiles
@ligz08
ligz08 / python-argparse.md
Last active May 15, 2018 06:37
Python `argparse` quick ref
@ligz08
ligz08 / postgres-cheatsheet.md
Last active June 24, 2018 16:30 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL in CLI

Usage:

psql [OPTION]... [DBNAME [USERNAME]]

Examples:

@ligz08
ligz08 / download.py
Created May 11, 2018 03:06
Download file with Python
url = 'https://www.web.site/downloads/file.zip'
# Method 1: With `requests` module
import requests
response = requests.get(url)
with open('local_file.zip', 'wb') as f:
f.write(response.content)