Skip to content

Instantly share code, notes, and snippets.

View matthewoestreich's full-sized avatar
♠️
👋

Matt Oestreich matthewoestreich

♠️
👋
View GitHub Profile
@matthewoestreich
matthewoestreich / json_treeview.ps1
Last active January 30, 2024 00:21
JSON TreeView - Extended
function Show-JsonTreeView {
param (
[Parameter(Mandatory)]
$Json
)
function Show-jsonTreeView_psf {
#----------------------------------------------
@matthewoestreich
matthewoestreich / arena-macos-fixes.sh
Created April 30, 2022 05:31 — forked from april/arena-macos-full-screen-fixes.sh
Fixes Magic Arena's broken full screen implementation on macOS
# this forces Arena into full screen mode on startup, set back to 3 to reset
# note that if you go into the Arena "Graphics" preference panel, it will reset all of these
# and you will need to run these commands again
defaults write com.wizards.mtga "Screenmanager Fullscreen mode" -integer 0
defaults write com.wizards.mtga "Screenmanager Resolution Use Native" -integer 0
# you can also replace the long complicated integer bit with any other scaled 16:9
# resolution your system supports.
# to find the scaled resolutions, go to System Preferences --> Display and then
# divide the width by 16 and multiple by 9. on my personal system this ends up
def run():
i = input("enter 20 numbers separated by spaces: ")
iList = i.split(" ")
validate_input(iList, 20)
nums = list_str_to_list_int(iList)
return calculate_sum(nums)
def validate_input(strList, expectedTotal):
l = len(strList)
if l != expectedTotal:
@matthewoestreich
matthewoestreich / ffmpeg_osx.sh
Last active February 11, 2022 23:33
record screen on mac osx monterrey via ffmpeg
#!/bin/bash
ffmpeg -f avfoundation -capture_cursor "1" -i "1" -pix_fmt yuv420p -r 25 out.mp4
# CAPTURE CURSOR SHOULD BE SAME AS SCREEN INDEX
# USE THIS TO GET SCREEN INDEX: `ffmpeg -f avfoundation -list_devices true -i ""`
(() => window.alert(1))();
@matthewoestreich
matthewoestreich / child_process_spawn.js
Created December 24, 2021 02:47
child_process.spawn node.js
// https://stackoverflow.com/a/10232330/10431732
const childProcess = require('child_process');
// just runs `ls -a ../`
const childp = childProcess.spawn('ls', ['-a', '../']);
// assign stdout to variable
const variable = chilldp.stdout;
// listen for events on that variable
variable.on('data', (data) => {
console.log('stdout: ' + data.toString());
@matthewoestreich
matthewoestreich / golangWaitXTimeChannelNoWaitGroups.go
Created December 18, 2021 03:43
golang wait for x time channel (no wait groups)
package main
import (
"fmt"
"math/rand"
"time"
)
func zzz(tme int) {
r := rand.Intn(10)
@matthewoestreich
matthewoestreich / callbackVsPromise.js
Last active December 6, 2021 19:55
callback h311
/**
*
* Callback vs Promise demo
*
*/
// A callback is nothing more than a parameter.
// Instead of accepting a string or object (or int, etc..), we accept
// a function instead.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div id="root"></div>
const http = require("http");
const fs = require("fs");
const fspath = require("path");
const url = require("url");
const server = http.createServer(async (request, response) => {
const path = url.parse(request.url).pathname;
switch (path) {
/**
* @route '/home' description for route