Skip to content

Instantly share code, notes, and snippets.

gistup
@strickc
strickc / lightsail-nodejs-quickstart.sh
Last active December 6, 2018 18:39
Bash script for AWS lightsail bitnami nodejs environment quick start
#! /bin/bash
# Create express app and configure apache httpd server
# creates sample-application in current directory (where the script is run from)
# To use run following commands from lightsail ssh session prompt:
# > git clone https://gist.github.com/strickc/9f59702d4fc47ef18ee45316448d73e2 quickstart
# > cd quickstart && ./lightsail-nodejs-quickstart.sh
# stop script on error
set -e
@strickc
strickc / customTerminal.desktop
Created September 24, 2018 20:30
Unity desktop launcher open terminal with initial bash commands
[Desktop Entry]
Version=1.0
Name=sourceStart
Comment=Source Developement Console
Exec=gnome-terminal -x /bin/bash -ic "cd ~/source; echo Starting in source dir; exec bash"
Terminal=false
X-MultipleArgs=true
Type=Application
Icon=utilities-terminal
StartupNotify=true
@strickc
strickc / 0optParser.sh
Created September 11, 2018 20:21
Bash options parser
# this script can be SOURCED by any other script to get options in local variables
# SCRIPTOPTx and OPTARGx (if x designated as `x:` to request an argument)
# i.e. from parent script:
# declare -A SCRIPTOPTS=( \
# [s]="Save to backup loaction" \
# [n:]="Copy resulting dtb to NFS boot folder, at designated location" \
# )
# `source ./0optParser.sh "$@"`
function printHelp {
@strickc
strickc / sheet.vbs
Created February 4, 2018 22:11
Auto update pivot tables Excel vba
' Paste in script for each worksheet you want to auto-update the pivot tables for
Private Sub Worksheet_Activate()
Dim p As PivotTable
For Each p In ActiveSheet.PivotTables
p.PivotCache.Refresh
Next p
Cells.EntireColumn.AutoFit
End Sub
@strickc
strickc / vsCodeVueESLint.md
Last active June 2, 2019 17:20
Configure VS Code for Vue.js component vue files for syntax highlighting and ESLint support within <script> tags
  1. Install ESLint VS Code extension

  2. Install Vue 2 Snippts VS Code extension

  3. Install eslint-plugin-html: npm install --save-dev eslint-plugin-html

  4. Add "plugins": ["html"] to eslintrc config file as per eslint-plugin-html instructions. Vue extension is enabled by default for the plugin.

  5. Open VS Code user settings and add vue to eslint.validate:

    "eslint.validate": [ "javascript", "javascriptreact", "vue" ]
    
@strickc
strickc / mPromptForRange.bas
Created March 6, 2017 01:13
VBA excel prompt user to select range
' Mutates the range passed in the paramter to a user selected value.
' Returns true if range is set, or false if not set (i.e. the user pressed cancel)
Function promptForRange(prompt As String, title As String, ByRef res As Range) As Boolean
promptForRange = False
On Error Resume Next
Set res = Application.InputBox(prompt, title, , , , , , 8)
On Error GoTo 0
If Not res Is Nothing Then promptForRange = True
End Function
@strickc
strickc / AttachLabelsToPoints.bas
Last active March 6, 2017 00:59
Populate chart labels from custom data in designated column Excel VBA
Function xValRange(cForm As String) As Range
Dim chunks() As String
chunks = Split(cForm, ",")
Set xValRange = Range(chunks(UBound(chunks) - 2))
End Function
'To use:
' 1) create a chart from x/y data in columns on the spreadsheet
' 2) add custom labels for specific points in an adjacent column
' 3) select the series in the chart and run the sub AttachLabelsToPoints (Alt-F8)
@strickc
strickc / mInterpolate.bas
Last active March 3, 2017 03:11
Excel VBA interpolate function
Public Function interpolate(knownValue As Double, knownRange As range, resultRange As range) As Double
Application.Volatile
Dim kR As Variant, uR As Variant, i As Integer, kBottom As Double, kTop As Double, uBottom As Double, uTop As Double, s As Integer
kR = knownRange
uR = resultRange
If (Not UBound(kR) = UBound(uR)) Or UBound(uR) < 2 Then
interpolate = CVErr(xlErrValue)
Exit Function
End If
For i = LBound(kR) To UBound(kR)
@strickc
strickc / Weather Report.markdown
Created August 31, 2015 07:24
Weather Report