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
function* takeWithTimerTask( | |
eventName: AnyEvent['type'], | |
timeoutEventName: AnyEvent['type'], | |
timeout: number | |
) { | |
const timerTask = yield* fork( | |
fireEventAfterDelayTask, | |
timeoutEventName, | |
timeout | |
) |
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
#!/usr/bin/env bash | |
# 95% CPU utilisation | |
threshold=0.95 | |
log_file="/var/log/kill-high-cpu-processes.log" | |
get_process_info() { | |
process_id=$1 | |
ps -p "$process_id" -o pid,ppid,cmd,%cpu,%mem,stat --no-header | awk '{$1=$1};1' |
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
xcrun simctl list devices | |
# Remove old devices stored under ~/Library/Developer/CoreSimulator/Devices (and clogging the disk) | |
xcrun simctl delete unavailable |
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
# in this example we are removing JPG files sitting alongside .nef files | |
for name in `ls * | sed 's/.\{4\}$//' | sort | uniq -d` | |
do | |
# Remove echo below to actually delete files | |
echo rm $name.jpg | |
done |
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
#!/usr/bin/env sh | |
sudo findmnt --verify --verbose |
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
function readonly(target: any, name: string, descriptor: TypedPropertyDescriptor<() => void>) { | |
descriptor.writable = false | |
return descriptor | |
} | |
class Example { | |
a: number | |
@readonly | |
b() {} |
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
CREATE OR REPLACE FUNCTION gen_random_string(_min_length INT = 3) | |
RETURNS VARCHAR | |
LANGUAGE SQL | |
AS ' | |
SELECT substring( | |
md5(random()::TEXT), | |
0, | |
_min_length + floor(random() * 10 + 1)::INT | |
) | |
'; |
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
# List all available database versions | |
aws rds describe-db-engine-versions --query '*[].[EngineVersion]' --output text --region eu-west-1 --engine postgres | |
aws rds describe-db-engine-versions --query '*[].[EngineVersion]' --output text --region eu-west-1 --engine aurora-postgresql | |
# Connect to Postgres via SSH's ProxyJump | |
ssh \ | |
-L 5555:your.private.postgres.hostname:5432 \ | |
-J your.proxy.hostname \ | |
private.hostname.with.access.to.postgres |
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
# Create a beefed up Podman virtual machine | |
podman machine init --cpus 3 --memory 6144 --disk-size 20 |
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
sudo multipass set local.driver=virtualbox # errors on my work laptop | |
# Default driver | |
sudo multipass set local.driver=hyperkit | |
# Create a VM | |
multipass launch --name ubuntu2004 | |
# Create a VM with custom parameters | |
multipass launch \ |
NewerOlder