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
-- IETF Draft Spec: https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-01.html | |
CREATE SEQUENCE uuidv7_seq MAXVALUE 4095; -- A 12-bit sequence | |
CREATE OR REPLACE FUNCTION generate_uuidv7() | |
RETURNS uuid AS $$ | |
DECLARE | |
unixts bigint; | |
msec bigint; | |
seq 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
Show hidden characters
# Get Sublime to use your rvm ruby... Change your ~/Library/Application Support/Sublime Text 2/Packages/Ruby/Ruby.sublime-build | |
# (for ST3: ~/Library/Application Support/Sublime Text 3/Packages/User/Ruby.sublime-build) to this, replacing YOURUSERNAME. | |
# I am still looking to optimize this further... For example, avoiding hardcoding by using something like $HOME, although | |
# I have yet to get any form of that to work. | |
{ | |
"working_dir": "${project_path}", | |
"cmd": [ | |
"/Users/YOURUSERNAME/.rvm/bin/rvm-auto-ruby", "-Ilib:test", "$file" | |
], |
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 | |
# Ensure a file name is provided | |
if [ -z "$1" ] | |
then | |
echo "No file name provided. Usage: ./split_file.bash <filename>" | |
exit 1 | |
fi | |
# Extract the directory and base name from the file |
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
20231124224207 ~/📄 bash> ollama run llama2-uncensored:70b | |
>>> Could the number 2137940590027877530 be nanoseconds since epoch? | |
No, it's not possible for that number to represent nanoseconds since epoch. The Unix timestamp system uses a base 10 representation of time, with each unit representing a | |
specific period of time. A nanosecond is one billionth of a second, so the maximum number of nanoseconds that can be represented by a 64-bit integer is 2^63 or | |
approximately 252 trillion. However, the number you provided is much larger than this and would therefore not represent any valid unit of time in the Unix timestamp | |
system. | |
>>> Apparently it translates to a date and time of 2037-09-30 16:23:10 UTC since Unix epoch when considered as nanoseconds | |
Yes, that is correct. When the number you provided is converted from its current representation to a base 10 format and interpreted as nanoseconds since epoch, it does | |
correspond to September 30th, 2037 at 4:23 PM UTC. However, as I mentioned earlier, this is not a va |
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 elixir | |
# make sure to bump max erlang processes limit first: | |
# export ERL_FLAGS="+P 2000000" | |
defmodule Concurrency do | |
def millions_of_us(n) do | |
receive do | |
{sender_pid, message} -> | |
Process.sleep(:rand.uniform(2000)) |
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
%!PS | |
%%BoundingBox: 0 0 612 792 | |
/Times-Roman findfont 12 scalefont setfont | |
% Define the starting coordinates | |
/x 72 def | |
/y 720 def | |
% Routine to wrap lines | |
/wordbreak ( ) def |
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
(Mainly because I love defeating people's arguments by using their own sources against them...) | |
1 John 2:2 "My little children, these things write I unto you, that ye sin not. And if any man sin, we have an advocate with the Father, Jesus Christ the righteous: He is the propitiation for our sins, and not for ours only but also for the sins of the whole world." | |
1 Corinthians 3:15 "If anyone's work is burned up, he will suffer loss, though he himself will be saved, but only as through fire. 15 But if the work is burned up, the builder will suffer great loss. The builder will be saved, but like someone barely escaping through a wall of flames." | |
1 Timothy 4:10 "For to this end we toil and strive, because we have our hope set on the living God, who is the Savior of all people, especially of those who believe..." | |
1 Peter 3:18 "For Christ also suffered once for sins, the righteous for the unrighteous, to bring you to God." | |
1 Corinthians 15:22 "For as in Adam all die, even so in Christ shall all be made alive." |
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
a few tests using `cjxl` (the reference `jpeg-xl` converter) I performed on a 120.7 MB PNG (the Carina Nebula, first photo from the James Webb Space Telescope): | |
there's 2 main parameters, "distance" (where 0 is lossless and 1 is the least detectable lossy; higher numbers are more lossy) and "effort" (compression effort, where 1 is quick and 9 is exhaustive/very long) | |
distance 0 effort 9 took 3 hours (obviously this is for a "write once, read many" sort of archival use-case) and got it down to about half of PNG, 67.2 MB; not bad for maintaining lossless. | |
distance 0 effort 6 took 1m43s, got it down to 75 MB, about 63% of PNG. | |
distance 1 effort 8 took 3 minutes and got it down to 7.7 MB which is about 1/15th of the PNG. | |
distance 1 effort 6 took 4s; got it to 7.1 MB... wait, _whut?_ That's... odd. Smaller than with effort 8. Anyway. | |
All encodings only used 1 of my 128 cores. Whole-image compression of this nature may not be "trivially parallellizable" ::shrug:: |
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
capture () { | |
local out_var out err_var err ret_var ret debugflag | |
debugflag= | |
if [ "$1" = "--debug" ]; then | |
debugflag=1 | |
shift | |
fi | |
if [ "$#" -lt 4 ]; then | |
echo "Usage: capture [--debug] <stdoutvar> <stderrvar> <returncodevar> command [arg ...]" | |
return 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
# return code is either 0 (success) or 1 (fail), so you can use it straight-up in logical statements | |
coinflip() { return $(($RANDOM%2)); } | |
coinflip && echo "heads" || echo "tails" |