Skip to content

Instantly share code, notes, and snippets.

Avatar
😐

Matt Keranen kmatt

😐
  • Central FL US
View GitHub Profile
@kmatt
kmatt / pg_podman.sh
Created March 21, 2023 20:07
Podman / Docker PostgreSQL on Windows 10
View pg_podman.sh
podman pull docker.io/library/postrges
podman volume create pg_data
podman run -dt --name postgres \
-e POSTGRES_PASSWORD=*** \
--mount type=volume,src=pg_data,target=/var/lib/postgresql/data \
-p 5432:5432 \
postgres
@kmatt
kmatt / clojure-learning-list.md
Created January 18, 2023 04:09 — forked from ssrihari/clojure-learning-list.md
An opinionated list of excellent Clojure learning materials
View clojure-learning-list.md

An opinionated list of excellent Clojure learning materials

These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.

  • 🔴 Mandatory (for both beginners and intermediates)
  • 🟩 For beginners
  • 🟨 For intermediates

Table of contents

  1. Getting into the language
@kmatt
kmatt / mssql_insert_json.py
Created January 17, 2023 02:37 — forked from gordthompson/mssql_insert_json.py
Alternative to_sql() *method* for mssql+pyodbc
View mssql_insert_json.py
# Alternative to_sql() *method* for mssql+pyodbc or mssql+pymssql
#
# adapted from https://pandas.pydata.org/docs/user_guide/io.html#io-sql-method
import json
import pandas as pd
import sqlalchemy as sa
def mssql_insert_json(table, conn, keys, data_iter):
@kmatt
kmatt / mssql_df_upsert.py
Created January 12, 2023 20:20 — forked from gordthompson/mssql_df_upsert.py
Build a T-SQL MERGE statement and upsert a DataFrame
View mssql_df_upsert.py
# version 1.2 - 2022-11-01
import pandas as pd
import sqlalchemy as sa
def df_upsert(data_frame, table_name, engine, schema=None, match_columns=None):
"""
Perform an "upsert" on a SQL Server table from a DataFrame.
Constructs a T-SQL MERGE statement, uploads the DataFrame to a
@kmatt
kmatt / zig-cross-compile-windows.sh
Created January 8, 2023 03:04
Cross compile to Windows using Zig
View zig-cross-compile-windows.sh
# On Linux or macOS
export CC="zig cc -target x86_64-windows-gnu
./configure --host x86_64-windows-gnu
make
@kmatt
kmatt / .vimrc
Last active January 4, 2023 00:39
MYVIMRC
View .vimrc
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let g:pymode_python = 'python3'
let g:python3_host_prog = expand('/usr/bin/python3')
call plug#begin()
Plug 'chrisbra/vim-diff-enhanced'
Plug 'cweagans/vim-taskpaper'
Plug 'dsolstad/vim-wombat256i'
@kmatt
kmatt / MacOSLogoutHook.txt
Last active November 23, 2022 19:19 — forked from RxDx/MacOSLogoutHook.txt
MacOS: Run script before shutdown
View MacOSLogoutHook.txt
Create a file:
$ vim /Users/Shared/logoutHook.sh
File content:
#!/bin/bash
say 'Hasta la vista baby!'
Set execution permission:
$ sudo chmod +x /Users/Shared/logoutHook.sh
View gist:6ef2450eba640d477e253cc2242d57ea
# brew install unixodbc
export CPPFLAGS="-I/opt/homebrew/Cellar/unixodbc/2.3.9_1/include"
export LDFLAGS="-L/opt/homebrew/Cellar/unixodbc/2.3.9_1/lib -liodbc -liodbcinst"
export PKG_CONFIG_PATH="/opt/homebrew/Cellar/unixodbc/2.3.9_1/lib/pkgconfig $PKG_CONFIG_PATH"
pip install --no-binary pyodbc pyodbc
@kmatt
kmatt / .zshrc
Created February 18, 2022 04:18 — forked from aiqc/.zshrc
zsh_prompt.txt
View .zshrc
# ========= PROMPT =========
# Version control information
autoload -Uz vcs_info
precmd() { vcs_info }
# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:git:*' formats ' %b '
# Render the prompt
setopt PROMPT_SUBST
@kmatt
kmatt / void-wsl.sh
Last active May 10, 2023 23:21
Install Void Linux on WSL2
View void-wsl.sh
# Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5
# prompt ">" indicates Powershell commands
# https://docs.microsoft.com/en-us/windows/wsl/install-win10
> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi