This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5 | |
# prompt ">" indicates Powershell commands | |
# prompt "$" are Linux shell 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download all Gists | |
for i in $(gh gist list -L 1000 | cut -f1); do echo "ID: $i"; gh gist view $i > $i; done | |
# Rename each file with a slug of the first line / description | |
for f in *; do mv -v $f $(gawk 'NR==1{gsub(/[^[:alnum:]]/, "-"); gsub(/-+/, "-"); print $0 "_" FILENAME}' $f); done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This shell prompt config file was created by promptline.vim | |
# | |
function __promptline_host { | |
local only_if_ssh="0" | |
if [ $only_if_ssh -eq 0 -o -n "${SSH_CLIENT}" ]; then | |
if [[ -n ${ZSH_VERSION-} ]]; then print %m; elif [[ -n ${FISH_VERSION-} ]]; then hostname -s; else printf "%s" \\h; fi | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Linux: curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
"PowerShell: iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |` ni $HOME/vimfiles/autoload/plug.vim -Force | |
let g:pymode_python = 'python3' | |
let g:python3_host_prog = expand('/usr/bin/python3') | |
call plug#begin() | |
Plug 'chrisbra/vim-diff-enhanced' | |
Plug 'csexton/trailertrash.vim' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Get-EventLog *).Log | fzf | % { Get-EventLog -LogName $_.Trim() -after (Get-Date).AddDays(-7) } | fzf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From https://fedoramagazine.org/wsl-fedora-33/ | |
# 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 | |
> wsl --set-default-version 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ([string]$s, [string[]] $d, [switch]$commit, [switch]$verbose, [string]$path=(Get-Location)) | |
# Install-Module -Name SqlServer -Scope CurrentUser | |
# Systemd service unit: | |
# ExecStart=/usr/bin/pwsh /localdata/SMOSchema/scripter.ps1 -s ALL -commit | |
# | |
# Add to $SERVICENAME.service.d/override.conf | |
# [Service] | |
# Environment=SQLCMDUSER= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pl_to_sql(df, table, replace=False): | |
""" | |
to_sql() without Pandas | |
Appends or overwrites a SQL Server table using data from a DataFrame | |
Parameters: | |
df (DataFrame): df used to create/append table | |
table (str): Name of existing SQL Server table | |
replace (bool): Truncate before insert | |
Returns: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT tbl::TEXT, HASH(tbl::TEXT), MD5(tbl::TEXT) FROM tbl; | |
D create table tbl as (select 1 as a, 2 as b, 3 as c); | |
D select tbl::text, hash(tbl::text), md5(tbl::text) from tbl; | |
┌──────────────────────────┬────────────────────────────┬──────────────────────────────────┐ | |
│ CAST(tbl AS VARCHAR) │ hash(CAST(tbl AS VARCHAR)) │ md5(CAST(tbl AS VARCHAR)) │ | |
│ varchar │ uint64 │ varchar │ | |
├──────────────────────────┼────────────────────────────┼──────────────────────────────────┤ | |
│ {'a': 1, 'b': 2, 'c': 3} │ 6764392534128998287 │ e31681d6e7ab078c9679fcd4f50136eb │ | |
└──────────────────────────┴────────────────────────────┴──────────────────────────────────┘ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing, os, sys, time | |
from itertools import izip | |
import redis | |
rr = None | |
def process_chunk(chunk): | |
global rr | |
if rr is None: | |
rr = redis.Redis() # Create one connection per process | |
print 'PID %d' % os.getpid() |
NewerOlder