Skip to content

Instantly share code, notes, and snippets.

@lundeen-bryan
lundeen-bryan / curl.cmd
Created September 15, 2020 02:57 — forked from gmarik/curl.cmd
@rem Do not use "echo off" to not affect any child calls.
@setlocal
@rem Get the abolute path to the parent directory, which is assumed to be the
@rem Git installation root.
@for /F "delims=" %%I in ("%~dp0..") do @set git_install_root=%%~fI
@set PATH=%git_install_root%\bin;%git_install_root%\mingw\bin;%PATH%
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%
@lundeen-bryan
lundeen-bryan / EnvironmentVariables.md
Last active February 15, 2022 03:46
EnvironVariables
Environment Variables Values (may vary)
%ALLUSERSPROFILE% C:\ProgramData
%APPDATA% C:\Users(user-name)\AppData\Roaming
%CD% (command prompt only) Current directory full path
%CMDCMDLINE% (comma
@lundeen-bryan
lundeen-bryan / TableInWord.bas
Last active February 20, 2022 17:12
TableInWord
Attribute VB_Name = "mod_TableInWord"
''===========================================================================================
'' Procedure: ......... TableInWord.bas/SizeTable
'' Description: ....... Create table if none, size all tables based on user input
'' Module URL: ........ https://gist.github.com/lundeen-bryan/3bcd197d287e1cc08957dd0c52337d50
'' Version: ........... 1.0.0 - major.minor.patch
'' Created: ........... 2022-02-20
'' Updated: ........... 2022-02-20
'' Compatibility: ..... Word
'' Install: ........... Save this as ".bas" file or copy and paste text to a module in vba IDE
Attribute VB_Name = "fnc_ReturnMyDocsPath"
' namespace=vba-files/Modules
' filename=fnc_ReturnMyDocsPath.bas
Option Explicit
Const sep As String = "\"
Public Function ReturnMyDocsPath_fnc() As String
@lundeen-bryan
lundeen-bryan / sql_cheatsheet.md
Last active May 5, 2022 02:17
SQL_Cheatsheet
Key CMD HINT
S SELECT SWEATY
F FROM FEET
W WHERE WILL
G GROUP BY GIVE
H HAVING HORRIBLE
O ORDER ODOR
@lundeen-bryan
lundeen-bryan / SQL_Pivot_Table_Walkthrough.sql
Last active May 5, 2022 19:15
SQL Pivot Table example and walkthrough
/*
Filename: ...: SQL_Pivot_Table_Walkthrough.sql
Date ........: 05-May-2022
Time ........: 08:11
Desc ........: Shows how to make a pivot tbl in SQL
Notes........:
1. See MSDN documentation for PIVOT at https://archive.ph/wip/VK8aD
2. Most code modified from Travis Cuzick's SQL course on Udemy
*/
USE [AdventureWorks2019]
@lundeen-bryan
lundeen-bryan / sql.json
Last active May 15, 2022 17:07
SQLsnippet
{
"Tips":{
"prefix": "b'sqltips",
"body": [
"--Sweaty(SELECT) Feet(FROM) Will(WHERE) Give(GROUP BY) Horrible(HAVING) Oder(ORDER BY)",
"--SELECT",
"--FROM",
"--WHERE",
"--GROUP BY",
"--HAVING",
@lundeen-bryan
lundeen-bryan / last_refreshed.bas
Last active July 13, 2022 16:35
how to make a count of last refreshed in powerquery
Start with the power query below:
let
Source = SourceData,
//the source needs to be a table that is in powerquery
#"Counted Rows" = Table.RowCount(Source),
#"Converted to Table" = #table(1, {{#"Counted Rows"}}),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Total_records"}}),
#"Added Custom" = Table.AddColumn(#"Renamed Columns", "Last_Refresh", each DateTime.LocalNow()),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Date", each DateTime.Date([Last_Refresh])),
@lundeen-bryan
lundeen-bryan / file_control.py
Created November 3, 2022 02:08
file read write util
import os
from os import path, sys
def read_file(file_name):
file_name = os.path.join(sys.path[0], file_name)
if path.isfile(file_name):
with open(file_name, mode="r") as file:
contents = file.readlines()
return contents
else:
@lundeen-bryan
lundeen-bryan / xlwings_test.ipynb
Last active January 22, 2023 17:20
just a test for sql in jupyter nb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.