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
# https://askubuntu.com/questions/15832/how-do-i-get-the-cpu-temperature | |
paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) \ | |
| column -s $'\t' -t \ | |
| sed 's/\(.\)..$/.\1°C/' |
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/bash | |
# | |
# Records the oudio from your browser and other applications. | |
# | |
# USAGE: | |
# | |
# record-system-output-audio.sh DURATION | |
# | |
# Where DURATION is [<HH>:]<MM>:<SS> or <SS>[s] (read ffmpeg-utils manual) | |
# |
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 SEQUENCE public.global_id_seq; | |
ALTER SEQUENCE public.global_id_seq OWNER TO postgres; | |
CREATE OR REPLACE FUNCTION public.id_generator() | |
RETURNS bigint | |
LANGUAGE 'plpgsql' | |
AS $BODY$ | |
DECLARE | |
our_epoch bigint := 1314220021721; | |
seq_id bigint; |
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/bash | |
# | |
# Removes a block to /etc/hosts. | |
# | |
# USAGE: | |
# | |
# $ block-site-add.sh EXAMPLE.COM | |
# 0.0.0.0 example.com | |
# 0.0.0.0 www.example.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
// Before | |
@Id | |
@Column(name = "entity_id") | |
@GeneratedValue(generator = "system-uuid") | |
@GenericGenerator(name = "system-uuid", strategy = "uuid2") | |
private String entityId; | |
// After | |
@Id | |
@Column(name = "entity_id") |
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
package com.example.idapi; | |
import java.util.Objects; | |
import com.github.f4b6a3.ulid.Ulid; | |
import com.github.f4b6a3.ulid.UlidCreator; | |
public abstract class Id<T extends Id<T>> implements Comparable<T> { | |
protected final Ulid value; |
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
private static class Lazy<T> { | |
private T object = null; | |
private Supplier<T> supplier; | |
private static final ReentrantLock lock = new ReentrantLock(); | |
public Lazy(Supplier<T> supplier) { | |
this.supplier = supplier; | |
} |
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
-- UUIDv7 canonical format: AAAAAAAA-BBBB-7CCC-DDDD-EEEEEEEEEEEE | |
select printf('%08x', ((strftime('%s') * 1000) >> 16)) || '-' || | |
printf('%04x', ((strftime('%s') * 1000) + ((strftime('%f') * 1000) % 1000)) & 0xffff) || '-' || | |
printf('%04x', 0x7000 + abs(random()) % 0x0fff) || '-' || | |
printf('%04x', 0x8000 + abs(random()) % 0x3fff) || '-' || | |
printf('%012x', abs(random()) >> 16); |
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 | |
INIT_TABLE_ROWS=20000000 | |
PGBENCH_TRANSACTIONS_PER_CLIENT=100000 | |
PGBENCH_CLIENTS=10 | |
run_test() { | |
echo "$(date +%y%m%d.%H%M) STARTING TEST $1" | |
pg_stop |
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 | |
# | |
# Append notes to today's text file in the notes folder. | |
# | |
# Usage: | |
# | |
# $ notes # append to today's file | |
# this is a note | |
# [CTRL+D] | |
# |
NewerOlder