Skip to content

Instantly share code, notes, and snippets.

Avatar
♠️
👋

Matt Oestreich oze4

♠️
👋
View GitHub Profile
@oze4
oze4 / arena-macos-fixes.sh
Created Apr 30, 2022 — forked from april/arena-macos-fixes.sh
Fixes Magic Arena's broken full screen implementation on macOS
View arena-macos-fixes.sh
# 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
View sum_even_odd.py
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:
@oze4
oze4 / ffmpeg_osx.sh
Last active Feb 11, 2022
record screen on mac osx monterrey via ffmpeg
View ffmpeg_osx.sh
#!/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 ""`
View xyz.js
(() => window.alert(1))();
@oze4
oze4 / child_process_spawn.js
Created Dec 24, 2021
child_process.spawn node.js
View child_process_spawn.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());
@oze4
oze4 / golangWaitXTimeChannelNoWaitGroups.go
Created Dec 18, 2021
golang wait for x time channel (no wait groups)
View golangWaitXTimeChannelNoWaitGroups.go
package main
import (
"fmt"
"math/rand"
"time"
)
func zzz(tme int) {
r := rand.Intn(10)
View callbackVsPromise.js
/**
*
* 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.
View react.babel.html
<!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>
View _server.js
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
@oze4
oze4 / babel.ts.html
Created Aug 29, 2021
Babel+TS in browser
View babel.ts.html
<!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>