- Video Encoding: https://handbrake.fr/
- Screen broadcasting, virtual screen camera: https://obsproject.com/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# codemod function generated by codemod AI to allow using ast-grep with autocomplete for local rules | |
# opted for macos + zshell | |
# use some AI to make it work on bash/linux/windows?? | |
codemod() { | |
local start_time=$(date +%s.%N) | |
local write_mode=false | |
local args=() | |
# Parse all arguments, extracting --write and keeping others |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this where you keep custom aliases and functions (e.g. ~/.bashrc or ~/.zshenv) | |
function nuke-ios() { | |
for arg in "$@"; do | |
if [[ "$arg" == "--help" ]] || [[ "$arg" == "-h" ]]; then | |
echo "nuke-ios: Resets the iOS workspace of a react-native project by deleting temporary artifacts." | |
echo | |
echo "Usage:" | |
echo " nuke-ios [options]" | |
echo | |
echo "Options:" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# prepends a comment with version info, timestamp and git commit hash | |
file="./build/embed.js" | |
timestamp=$(date '+%Y-%m-%d %H:%m:%S') | |
commithash=$(git rev-parse --short HEAD) | |
version=$(cat ./package.json | grep version -m 1 | sed 's/"version": "//' | sed 's/",//' | xargs) | |
buildinfo="$version $timestamp $commithash" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# local: package version | |
package_version=$(cat package.json | grep version -m 1 | sed 's/"version": "//' | sed 's/",//' | xargs) | |
# git: package version | |
git_package_version=$(git show HEAD^^^:package.json | grep version -m 1 | sed 's/"version": "//' | sed 's/",//' | xargs) | |
# react-native: current android version | |
android_version=$(cat android/app/build.gradle | grep versionName | sed 's/versionName "//' | sed 's/"//' | xargs) | |
android_build=$(awk '/versionCode/ && !/versionCodes/ && /[0-9]+/ {gsub(/[^0-9]/, "", $2); print $2}' android/app/build.gradle) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this in your ~/.bashrc | |
gzipped() { | |
if [ -z $1 ]; then | |
echo "No file specified" | |
else | |
b=$(gzip -c $1 | wc -c) | |
echo "$b B" | |
KB=$(awk "BEGIN {printf \"%.2f\n\", $b/1024}") | |
echo "$KB KB" | |
MB=$(awk "BEGIN {printf \"%.2f\n\", $b/1024/1024}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Editor from '@monaco-editor/react'; | |
import { format } from 'sql-formatter'; | |
export type InputEvent = { target: { name: string; value: string } }; | |
export default function MonacoSqlInput({ | |
value, | |
name = '', | |
height = 500, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import escapeRegExp from 'lodash.escaperegexp'; | |
// based on https://stackoverflow.com/a/47803998/368254 | |
export function Highlighted({ children: text = '', highlight = '' }) { | |
if (!highlight.trim()) { | |
return <span>{text}</span>; | |
} | |
const regex = new RegExp(`(${escapeRegExp(highlight)})`, 'gi'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# realpath is not available on mac os | |
# this might be a useful alternative | |
abs_path () { | |
echo "$(cd $(dirname "$1");pwd)/$(basename "$1")" | |
} | |
echo $(abs_path .) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using console.trace in several places when debugging can be quite the PITA because it prints the entire | |
// stack directly to the output and makes it difficult to find and read other log messages | |
// | |
// this variant will print a neatly collapsed object with a "stack" property that you can manually expand when needed | |
console.log('>>', { trace: new Error().stack?.slice(12).split('\n') }); |
NewerOlder