Skip to content

Instantly share code, notes, and snippets.

View tekkies's full-sized avatar

Andy Joiner tekkies

View GitHub Profile
#1. Run https://www.userbenchmark.com/
#2. Visit in Edge: https://boxstarter.org/package/url?https://gist.githubusercontent.com/tekkies/31c40d8dd891b9337f6fe897acda6aeb/raw/windows-machine.boxstarter
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
choco install -y manictime
choco install -y googlechrome
choco install -y ditto
@tekkies
tekkies / lis3dsh-sudden-y.lua
Created January 15, 2022 17:54
LIS3DSH State Machine - Trigger on sudden change in Y
--writeLis3dsh(LIS3DSH_CTRL_REG2, 0x01) --Interrupt 1, SM2 Enable
writeLis3dsh(LIS3DSH_CTRL_REG2, 0x08 + 0x01) --Interrupt 2, EM2 Enable
writeLis3dsh(LIS3DSH_CTRL_REG3, 0x28) --data ready signal not connected, interrupt signals active LOW, interrupt signal pulsed, INT1/DRDY signal enabled, vector filter disabled, no soft reset
writeLis3dsh(LIS3DSH_CTRL_REG4, 0x10 + 0x00 + 0x02) --Y, data rate: 3Hz, Block data update: continuous
writeLis3dsh(LIS3DSH_CTRL_REG5, 0x00) --2g scale, 800hz filter
writeLis3dsh(LIS3DSH_THRS1_2, 1) --threshold
writeLis3dsh(LIS3DSH_ST2_1, 0x05) --NOP | Any/triggered axis greater than THRS1
writeLis3dsh(LIS3DSH_ST2_1+1, 0x11) --Continue
writeLis3dsh(LIS3DSH_MASK2_B, 0x30) --Y
writeLis3dsh(LIS3DSH_MASK2_A, 0x30) --Y
@tekkies
tekkies / NodeMCU-LIS3DSH.md
Last active December 28, 2021 20:23
NodeMCU LIS3DSH Accelerometer Lua Test
spi.setup(1, spi.MASTER, spi.CPOL_HIGH, spi.CPHA_HIGH, 8, 255)
spi.transaction(1, 0, 0, 8, 0x80 + 0x0f,0,0,8)
read = spi.get_miso(1,0,8,1)
print("Who_AM_I register (expect 3f): " .. string.format("%x", read))

Output should be Who_AM_I register (expect 3f): 3f

This tests that the LIS3DSH is detected on the port when wired

@tekkies
tekkies / Get-AzureDevOpsItems
Last active January 15, 2021 19:06
Example Query AzureDevOps API Using a Personal Access Token
$ErrorActionPreference = "Stop"
if($env:AdoOrganisation -eq $null)
{
Write-Error 'Please set $env:AdoOrganisation'
}
if($env:AdoProject -eq $null)
{
Write-Error 'Please set $env:AdoProject'
}
@tekkies
tekkies / Invoke-SqlcmdUsingConnectionString.ps1
Last active July 16, 2019 23:10
Invoke-SqlcmdUsingConnectionString
function Get-ConnectionStringComponent($components, $key) {
$component = $components | where { $_.StartsWith("$key=") }
$value = $component.Split("=")[1]
return $value
}
function Invoke-SqlcmdUsingConnectionString($connectionString, $query){
$components = $connectionString.Split(";")
$serverInstance = Get-ConnectionStringComponent $components "Data Source"
$database = Get-ConnectionStringComponent $components "Initial Catalog"
@tekkies
tekkies / Template.ps1
Last active July 1, 2020 17:08
Template PowerShell script with help and params
<#
.SYNOPSIS
10 words
.DESCRIPTION
Tweet
.NOTES
Full description
On multiple lines
.PARAMETER Mandatory
This ian a mandatory param
@tekkies
tekkies / commit-msg
Created September 17, 2015 11:08
Git commit-msg hook to enforce usage of #risk and #story (e.g. #risk3, #story1234)
#!/bin/sh
# Save this file as .git/hooks/commit-msg
test "" != "$(grep '\#risk' "$1")" || {
echo >&2 \#risk is required in the commit message
exit 1
}
test "" != "$(grep '\#story' "$1")" || {
echo >&2 \#story is required in the commit message
@tekkies
tekkies / ReportCaughtException.java
Last active January 2, 2016 04:59
Report Android caught exceptions as a Google Analytics events (http://www.google.com/analytics/mobile/). Extracts minimal essential exception data and reports it. It's not reported as an App exception - just an interesting event :)
Replace com.example with your package.
/**
* Extracts minimal essential exception data and reports it as a Google Analytics event
* (Not reported as an App exception :).<br/>
* <br/>
* Reported action: Exception type & message<br/>
* Reported label: File & line no
* <code><pre>
* } catch (Exception e) {
@tekkies
tekkies / indented-checkboxes.md
Last active October 5, 2023 02:59
Indented markdown checkbox example

Nested checkbox rendering would be nice (view the sourcer for this gist)

  • Task 1
  • Task 2
    • Subtask a
    • Subtask b
  • Task 3

There's no need to complete parents when child nodes are all checked.