source-c’s gists

Comparison Table of Go GUI Libraries

Here's a feature comparison table of the native cross-platform GUI libraries for Go (web technologies based ones are completely skipped):

Feature Fyne GoGi Gio Qt Bindings andlabs/ui
Basic Widgets
Labels
Buttons
Text Input
import {format as dateFmt} from 'date-fns'
export const getRelativeTime = (locale: string, d1: Date, d2: Date = new Date()): string => {
// in milliseconds
const units = {
year: 24 * 60 * 60 * 1000 * 365,
month: 24 * 60 * 60 * 1000 * 365 / 12,
day: 24 * 60 * 60 * 1000,
hour: 60 * 60 * 1000,
minute: 60 * 1000,
export const isString = (obj: unknown) =>
obj !== undefined
&& obj !== null
&& (obj instanceof String || typeof obj === 'string');
export const isNone = (v?: unknown): boolean => v === undefined || v === null;
export const isUndefined = (v?: unknown): boolean => v === undefined;
export const isBool = val => 'boolean' === typeof val;
export const asBool = (v?: unknown): boolean =>
type OptionalTypeOrNull<T> = T | undefined | null;
type Nullish = undefined | null;
type Falsy = false | "" | 0 | 0n | Nullish;
type Truthy<T> = T extends Falsy ? never : T;
type AnyCollection = ArrayLike<unknown>;
type AnyObject = { [p: string]: AnyObject | AnyCollection | unknown };
type Maybe<T> = T | Nullish;
type MaybePromise<T> = Promise<T> | T;
type Immutable<T> = {
readonly [K in keyof T]: Immutable<T[K]>;
#!/usr/bin/env bash
current_level=$(pmset -g batt|grep InternalBattery-0|sed -n 's#.*[[:space:]]\([[:digit:]]\{1,\}\)%.*#\1#p')
[[ -z ${current_level} ]] && current_level='--'
echo ${current_level}
#!/usr/bin/env bash
mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
-Dartifact=net.minidev:asm:1.0.2 \
-DrepoUrl=https://mvnrepository.com/artifact/net.minidev/asm
exec jshell --class-path \
~/.m2/repository/com/jayway/jsonpath/json-path/2.6.0/json-path-2.6.0.jar:\
~/.m2/repository/net/minidev/json-smart/2.4.7/json-smart-2.4.7.jar:\
~/.m2/repository/net/minidev/asm/1.0.2/asm-1.0.2.jar:\
#!/usr/bin/env bash
ALL_REPOS=$(ls -1)
GIT_EXE="git"
GIT_PULL_CMDLINE="pull --all --ff"
GIT_FALLBACK="pull --all --rebase"
GIT_PRUNE_ORIGIN="remote prune origin"
echo $(pwd)
SELECT
t.tablename,
indexname,
c.reltuples AS num_rows,
pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) AS table_size,
pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size,
CASE WHEN indisunique THEN 'Y'
ELSE 'N'
END AS "UNIQUE",
idx_scan AS number_of_scans,
SELECT pid, age(clock_timestamp(), query_start), usename, query, state
FROM pg_stat_activity
WHERE state != 'idle' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
select
relname as relation_name,
query,
pg_locks.*
from pg_locks
join pg_class on pg_locks.relation = pg_class.oid
join pg_stat_activity on pg_locks.pid = pg_stat_activity.pid