Skip to content

Instantly share code, notes, and snippets.

View oze4's full-sized avatar
♠️
👋

Matt Oestreich oze4

♠️
👋
View GitHub Profile
@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)
@oze4
oze4 / cookies.js
Last active December 10, 2021 22:45
export default class Cookies {
static get(name) {
if (document.cookie.length === 0) {
return null;
}
const start = document.cookie.indexOf(`${name}=`);
if (start == -1) {
return null;
}
const end = document.cookie.indexOf(";", start);
@oze4
oze4 / 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.
@oze4
oze4 / react.babel.html
Created November 15, 2021 07:19
React/Babel
<!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
@oze4
oze4 / babel.ts.html
Created August 29, 2021 17:19
Babel+TS in browser
<!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>
@oze4
oze4 / capsFirstLetter.js
Created August 21, 2021 16:12
caps first letter in str
function capsFirstLetter(str) {
if (typeof str !== "string") {
throw new Error("param `str` must be a string!");
}
const firstLetterCaps = str[0].toUpperCase();
const restOfString = str.slice(1);
return firstLetterCaps + restOfString;
}
const myStr = "something";