And another UUID function. This one also generates UUIDv7, just like the the one in the previous post , but this one is designed to work in PostgresSQL, instead of MySQL As before: either use this inline in your select statement, or convert it to a function.
Category Archives: Computers
UUIDv7 in MySQL
Similar to my previous post, this code generates a UUID of the new v7 type, which has a Unix-timestamp base. This keeps UUIDs sortable by creation-date, which is useful when using them as database keys, for example You can either use this inline in your select statement, or convert it to a function.
UUIDv4 in MySQL
Although MySQL has a UUID() function, it returns a version 1 UUID, which is time-based and has mostly been replaced by the completely random version 4. I recently needed a v4 in a query, and adapted this from some different options I found online: You can either use this inline in your select statement, or convert […]
Upgrading Samba 3 to 4 on FreeBSD
Since Samba 3.6 finally became end-of-life on FreeBSD, I’ve been forced to upgrade to Samba 4 on my servers. Luckily, it was a relatively painless update. # portmaster ‑o net/samba43 samba36‑3.6.25_1 # mv /usr/local/etc/smb.conf /usr/local/etc/smb4.conf # mv /usr/local/etc/samba/* /var/db/samba4/private/ Finally, in /etc/rc.conf replace samba_enable=“YES” with samba_server_enable=“YES”. You can now restart Samba with the command: # […]
Reducing the number of disks in a ZFS pool
In the past I’ve shown how easy it is to expand a ZFS pool by adding extra disks. While this is the easiest way of expanding your storage capacity, it does come with a downside: From that moment on, you’re stuck with the larger number of disks, as ZFS does not have an easy way of […]
Fixing NextGEN Gallery and wp-typography compatibility
I figured out what broke the images on this site a while back. I run several plugins on this wordpress site, among which are NextGEN Gallery (an image gallery plugin) and wp-typography (which cleans up typography and styles certain parts of the text). However, a patch of NextGEN gallery a while back broke the compatibility of these […]
Rebuilding world on FreeBSD
To upgrade FreeBSD between versions, I generally rebuild world with the latest sources. You can easily get the ‑RELEASE tarballs using fetch. I generally remove the old /usr/obj and /usr/src completely before I start. # cd /usr # rm ‑R obj # rm ‑R src # fetch “ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.0‑RELEASE/src.txz” # tar ‑x ‑C / ‑f src.txz Obviously, for […]
Growing a ZFS pool — Update
In an earlier post I described how you can grow an existing ZFS pool by replacing all the disks with bigger ones. That article was written several years ago, for FreeBSD 7.2. Currently we’re at FreeBSD 9.2, and the ZFS implementation has evolved somewhat, making that article no longer accurate. Most importantly, this concerns the […]
Using GMirror as a rollback tool.
On Thunderflare, which predates affordable solid-state drives, the OS is run from two small laptop drives in RAID 1. The RAID 1 is there so that if one of them crashes, I won’t have to do a complete reinstall. I’m lazy, sue me. Besides, a reinstall would take a lot of time, while setting up […]
Machine army and Penelope timeline
I’ve updated the Machine Army page with a list of my current and past machines. I’ll expand this page further as I have the time. I’ve also published the full upgrade timeline for Penelope, my main workstation.