Skip to content

Instantly share code, notes, and snippets.

View oze4's full-sized avatar
♠️
👋

Matt Oestreich oze4

♠️
👋
View GitHub Profile
@oze4
oze4 / triggerInputChange.js
Created April 17, 2024 04:56
Programmatically set input on React rendered DOM elements.
/**
* Programmatically set input.
* https://stackoverflow.com/a/72014541/10431732
*
* @param {HTMLElement} node
* @param {String} value
* @example - You would use it like this:
const textarea = document.querySelector("textarea");
const submitButton = document.querySelector('button[aria-label="Submit"]');
const TEXT_TO_TYPE = "hello, world!";
<blockquote class="tiktok-embed" cite="https://www.tiktok.com/@scout2015/video/6718335390845095173" data-video-id="6718335390845095173" style="max-width: 605px; min-width: 325px">
<section>
<a target="_blank" title="@scout2015" href="https://www.tiktok.com/@scout2015?refer=embed">@scout2015</a> Scramble up ur name &#38; I’ll try to guess it😍❤️ <a title="foryoupage" target="_blank" href="https://www.tiktok.com/tag/foryoupage?refer=embed">#foryoupage</a>
<a title="petsoftiktok" target="_blank" href="https://www.tiktok.com/tag/petsoftiktok?refer=embed">#petsoftiktok</a> <a title="aesthetic" target="_blank" href="https://www.tiktok.com/tag/aesthetic?refer=embed">#aesthetic</a>
<a target="_blank" title="♬ original sound - tiff" href="https://www.tiktok.com/music/original-sound-6689804660171082501?refer=embed">♬ original sound - tiff</a>
</section>
</blockquote>
<script async src="https://www.tiktok.com/embed.js"></script>
Client-Side: client side: import React, { useState } from "react";
function VideoButton() {
const [downloadLink, setDownloadLink] = useState(null);
const [videoName, setVideoName] = useState(null); // State to store the video file name
const uploadFile = (event) => {
const file = event.target.files[0];
if (file) {
const formData = new FormData();
@oze4
oze4 / json_treeview.ps1
Last active January 30, 2024 00:21
JSON TreeView - Extended
function Show-JsonTreeView {
param (
[Parameter(Mandatory)]
$Json
)
function Show-jsonTreeView_psf {
#----------------------------------------------
@oze4
oze4 / arena-macos-fixes.sh
Created April 30, 2022 05:31 — forked from april/arena-macos-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:
@oze4
oze4 / 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 ""`
@oze4
oze4 / xyz.js
Created January 1, 2022 00:19
alert
(() => window.alert(1))();
@oze4
oze4 / 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());
@oze4
oze4 / 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)