Skip to content

Instantly share code, notes, and snippets.

@scottleedavis
scottleedavis / chocoUpdate.ps1
Last active October 1, 2023 21:49
chocoUpdate.ps1
choco upgrade all -y
@scottleedavis
scottleedavis / chocolatey_add_existing.ps1
Last active October 1, 2023 18:59
admin powershell 'add all install applications to chocolately'
# Assuming $output contains the result of 'choco list -i'
$output = choco list -i
# Split the output into lines
$lines = $output -split "`n"
# Find the index of the phrase "packages installed."
$startIndex = [Array]::IndexOf($lines, ($lines | Where-Object { $_ -match "packages installed\.$" }))
# Find the index of the phrase "applications not managed with Chocolatey."
/*
* Globals
*/
/* Links */
a,
a:focus,
a:hover {
color: #fff;
}
@scottleedavis
scottleedavis / run_openfaas_imagecrawler_exif.sh
Created October 26, 2019 04:08
runs an openfaas function imagecrawler and feeds the results to the function exif
echo https://lotussoulstudios.com | faas-cli invoke openfaas-imagecrawler | jq .. > urls.txt
input="./urls.txt"
while IFS= read -r line
do
line="${line%\"}"
line="${line#\"}"
echo $line | faas-cli invoke openfaas-exif | jq
done < $input
@scottleedavis
scottleedavis / example_python_basic.py
Created October 2, 2019 03:48
an example python script that parses and runs BASIC
#from https://repl.it/@meesh/BASIC-interpreter-in-Python
program = '''
10 REM POWER TABLE
11 DATA 8, 4
15 READ N0, P0
20 PRINT "N",
25 FOR P = 2 to P0
30 PRINT "N ^" P,
35 NEXT P
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
creationTimestamp: "2019-09-22T22:59:28Z"
generation: 1
labels:
app: fn
name: fn
apiVersion: v1
kind: ServiceAccount
metadata:
name: eks-admin
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: eks-admin
package main
import (
"bufio"
"bytes"
"fmt"
"gopkg.in/auyer/steganography.v2"
"image"
"os"
)
package main
import (
"bufio"
"bytes"
"fmt"
"gopkg.in/auyer/steganography.v2"
"image"
"os"
)
@scottleedavis
scottleedavis / smi_rankData_to_csv.js
Last active June 14, 2018 00:22
extracts the rankData object to csv on the socialmobilityindex website
var lineArray = [];
rankData.forEach(function (infoArray, index) {
infoArray = infoArray.map( (info) => {
if( typeof info === "string" )
return info.replace(/,/g, "").replace(/\$/g, "");
else
return info;
});
var line = infoArray.join(",");
lineArray.push(line);