Skip to content

Instantly share code, notes, and snippets.

View alexfu's full-sized avatar

Alex Fu alexfu

View GitHub Profile
@alexfu
alexfu / DateTimeExtensions.kt
Created July 22, 2022 17:29
Do you wish there was an easier way to write dates in Kotlin?
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.Month
import java.time.ZonedDateTime
import java.util.TimeZone
fun January(day: Int, year: Int) = LocalDate.of(year, Month.JANUARY, day)
fun February(day: Int, year: Int) = LocalDate.of(year, Month.FEBRUARY, day)
fun March(day: Int, year: Int) = LocalDate.of(year, Month.MARCH, day)
fun April(day: Int, year: Int) = LocalDate.of(year, Month.APRIL, day)
@gjrdiesel
gjrdiesel / README.md
Last active April 13, 2024 13:55
Expand Ubuntu 20 Proxmox Disk
# Resize the file system in UI, under VM -> Hardware -> Click on the disk to resize, click "Resize disk" button

# Confirm increase in disk space (1TB in my case)
$ lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                         8:0    0    1T  0 disk
├─sda1                      8:1    0    1M  0 part
├─sda2                      8:2    0    1G  0 part /boot
└─sda3                      8:3    0    1T  0 part
@JakeWharton
JakeWharton / AutoGson.java
Last active November 28, 2021 12:32
A Gson TypeAdapterFactory which allows serialization of @autovalue types. Apache 2 licensed.
import com.google.auto.value.AutoValue;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* Marks an {@link AutoValue @AutoValue}-annotated type for proper Gson serialization.
* <p>
@jjb
jjb / gist:2347804
Created April 10, 2012 01:30
How to build the pg gem on os x with macports

First, install your preferred version of postgres

sudo port install posgresql84

Now you have psql84 available, which rolls right off your fingers. Even better, your pg_config is buried in a postgresql84 namespace. Fix both of these with:

sudo port select --set postgresql postgresql84

Now you can intall the gem