Skip to content

Instantly share code, notes, and snippets.

View kstrauss's full-sized avatar

Karl Strauss kstrauss

  • Realgy LLC
  • Hartford area, CT
View GitHub Profile
@kstrauss
kstrauss / depersonalize.cs
Last active April 26, 2023 01:57
Simple samples of functions to depersonalize data
async void Main()
{
// baby first names https://github.com/hadley/data-baby-names
var fnames = ReadFileAsync(@"C:\temp\depersonal\bfnames.csv");
// surnames https://github.com/fivethirtyeight/data/blob/master/most-common-name/surnames.csv
var lnames = ReadFileAsync(@"C:\temp\depersonal\surnamesClean.csv");
var testNames = ReadFileAsync(@"c:\temp\depersonal\nbaPlayers.csv");
var r = new Random();
int Max = 3;
var result = new int[Max];
@kstrauss
kstrauss / contractEnd.seq
Created March 23, 2023 14:35
working through a few sequence diagrams with VNDLY
sequenceDiagram
VNDLY->>+Workday: Raise Contract End (via Connector)
CML->>+VNDLY: update PO and extend date
VNDLY->>+Workday: send new PO (via file)
Workday->>+Workday: Reject change of PO, because of Contract End
@kstrauss
kstrauss / WebscanCheck.seq
Created January 18, 2023 15:54
Describes the basic flow for website redirection that was used
sequenceDiagram
WebsiteCheck ->> Scanner: Does WebsiteA exist?
Scanner ->> WebsiteA: Get Request
WebsiteA ->> Scanner: Yes, but redirect to WebsiteB
Scanner ->> WebsiteB: Get Request
WebsiteB ->> Scanner: Good Response
Scanner ->> WebsiteCheck: Yes, but it is really WebsiteB
@kstrauss
kstrauss / idea.ps1
Created December 4, 2021 01:33
powershell bar chart - thought/idea of doing an ascii bar chart from a group by data (count)
function GraphMe {
[CmdletBinding]
param(
[Parameter()]
[Hashtable] $something
)
<#
max_value = max(count for _, count in data)
increment = max_value / 25
@kstrauss
kstrauss / FindAndConvert.ps1
Last active July 22, 2020 03:42
Conversion of word docs to PDF and then combine into one large pdf for a set of directories
$d2 = dir -recurse -filter *.doc
$word = new-object -comobject Word.Application
$NotFound = @()
$errors = @()
$d2 | ForEach-Object {
$doc = $null
try{
$f = $_;
@kstrauss
kstrauss / dockerfile
Created April 26, 2019 20:29
python example dockerfile for linux
#from alpine:latest as base
from python:3.7.3-alpine as base
from base as builder
RUN apk add --no-cache python3 python3-dev py-pip build-base
# create directory to copy files to
RUN mkdir /install/
WORKDIR /install
@kstrauss
kstrauss / Thoughts.md
Last active April 26, 2019 16:22
Simple example of python and docker. This as an idea of how perhaps we could offer a general way deploying some code from a git repo into a python container. The main question to me is how should things be triggered/scheduled.

Concerns

  • monitoring
    • is this the job of our container runner (i.e. cloud foundry)
  • how to kick off?
    • orchestration if there are several apps/containers that need to run? Is this part of cloud foundry or another piece that may be required?
  • what's the guidance of how to provide data to be used?
    • should it be the job of the python code to acquire (from files via scp, query a db)? Something else?

Problems to solve

@kstrauss
kstrauss / LauraSimpleMatch.ps1
Last active September 27, 2018 14:08
a dumb way of matching up filenames to a list of names on the clipboard.
<#
https://gist.github.com/kstrauss/eb99f398d191426038067ab15a6a951a
Get filenames of PDF files, which are supposed to match the customer names in the sales Requests/Commission reports.
Potentially this should be limited to only a set of files from a certain period ??
#>
Cd 'Z:\CUSTOMER SERVICE\Customer Executed Contracts\ENDURE MARKETING'
$fnames = dir *.pdf | %{ $_.basename}
<#
Go copy the customer names you want to compare against. (i.e. go to excel and select the customer
@kstrauss
kstrauss / Test.graphviz
Created June 28, 2018 20:26
Test Process
digraph G {
graph [fontsize=10 fontname="Verdana" compound=true];
node [shape=record fontsize=10 fontname="Verdana"];
subgraph cluster_Development {
style=filled;
color=lightgrey;
label = "Development";
ReadSpecs -> PhysicalSentIntegration;
ReadSpecs -> PhysicalReceivedIntegration;
@kstrauss
kstrauss / EarlyWarning.cs
Created June 19, 2018 14:38
returns an observable that provides the first in a window and lets you know when the window closes and what was in the window
void Main()
{
var closer = new Subject<Tuple<WindowState, IList<long>>>();
closer.Select(c => {
if (c.Item1 == WindowState.Open)
{
return $"Should email, with an event of {c.Item2.Single()}";
}
else