Skip to content

Instantly share code, notes, and snippets.

View 808codist's full-sized avatar

Dave Pascua 808codist

  • Kentik
  • Honolulu HI
View GitHub Profile
@808codist
808codist / getLatestGo.sh
Last active April 6, 2024 23:00
When *upgrading* your Go version to latest, use this script to download the latest version for your distro & arch. (This script assumes you already have Go installed.)
#!/usr/bin/env bash
# source: https://gist.github.com/808codist/fe5c8d2118afc1a05ed11d6b86da92b3
set -o errexit # exit on 1st error
set -o nounset # referencing unset vars is an error
dlUrl='https://go.dev/dl/'
allVersionsUrl="$dlUrl?mode=json"
osArch="$(go env GOHOSTOS)-$(go env GOARCH)"
@808codist
808codist / choco.md
Last active August 17, 2022 23:21
how I rebuild my environment after fresh Windows install

Process

  1. Ctrl-X, A to start PowerShell as Administrator
    1. Rename-Computer -NewName “the-new-name”
    2. Copy & run PowerShell install command from chocolatey install page.
    3. choco feature enable -n=allowGlobalConfirmation
    4. choco install 7zip Firefox PDFXChangeViewer autohotkey ditto git GoogleChrome grammarly grammarly-chrome jetbrainsmono obsidian sharex signal stretchly vim vlc slack zoom
  2. Log into password manager.
  3. Manually install & register
    • xplorer2
  • IDE
@808codist
808codist / dataweaveCookbook.md
Last active March 21, 2021 19:36
Mule Dataweave Cookbook

only one so far... :-)

base-64 binary encode/decode

%dw 2.0
output application/json
import * from dw::core::Binaries
var mime = 'application/json'
var og = {foo:'bar'}
var str = toBase64(write(og,mime) as Binary)
@808codist
808codist / getRbGuid.sql
Created May 6, 2020 23:07
get SCORCH runbook's GUID
SELECT distinct LOWER(POLICIES.UniqueID) AS RunbookID
-- , LOWER(CUSTOM_START_PARAMETERS.UniqueID) AS ParameterID
-- , CUSTOM_START_PARAMETERS.value
FROM POLICIES
INNER JOIN OBJECTS
ON POLICIES.UniqueID = OBJECTS.ParentID
LEFT OUTER JOIN CUSTOM_START_PARAMETERS
ON OBJECTS.UniqueID = CUSTOM_START_PARAMETERS.ParentID
WHERE POLICIES.Name = 'RB1'
AND policies.deleted = 0;
@808codist
808codist / startScorchRunbook.ps1
Created May 6, 2020 20:06
start SCORCH runbook
# source: http://msdn.microsoft.com/en-us/library/hh921685.aspx
# just in case above URL goes bye-bye
#
# Details of the runbook we are going to run
$rbid = "00000000-0000-0000-00000000000000001"
$rbParameters = @{"00000000-0000-0000-00000000000000002" = "This is the value for Param1.";" 00000000-0000-0000-00000000000000003" = " This is the value for Param2."}
# Create the request object
$request = [System.Net.HttpWebRequest]::Create("http:// server01.contoso.com:81/Orchestrator2012/Orchestrator.svc/Jobs")
@808codist
808codist / sqlite_foreign_key.go
Created April 20, 2018 17:54
golang sqlite foreign key example
package main
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
"log"
)
func main() {
db, err := sql.Open("sqlite3", ":memory:")
@808codist
808codist / alternate.go
Last active January 17, 2023 20:52
Go + sqlite example: use custom function in trigger to validate insert
package main
// functionally same as `main.go`, with different trigger definition
import (
"database/sql"
"fmt"
sqlite "github.com/mattn/go-sqlite3"
"log"
"os"
)