- Video Encoding: https://handbrake.fr/
- Screen broadcasting, virtual screen camera: https://obsproject.com/
This file contains 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 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 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 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 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 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 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 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') }); |
Helper bookmarklets to display all keys and values of a gitlab secrets page in a single element. This way, you can copy them all in one go.
Why? Because otherwise, you'd have to select, copy and paste each key and value manually, which is tedious.
Not a common use case, but I needed this several times, e.g. when requested by project managers, or when you need to replicate deployments or builds on a different system or locally.
NewerOlder