# https://developer.aliyun.com/article/110806
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
-- Reasonably efficient pagination without OFFSET | |
-- SQLite version (Adapted from MS SQL syntax) | |
-- Source: http://www.phpbuilder.com/board/showpost.php?p=10376515&postcount=6 | |
SELECT foo, bar, baz, quux FROM table | |
WHERE oid NOT IN ( SELECT oid FROM table | |
ORDER BY title ASC LIMIT 50 ) | |
ORDER BY title ASC LIMIT 10 |
#include <assert.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#define N (100000063/64) | |
struct bitset { | |
uint64_t bits[N]; |
// Website you intended to retrieve for users. | |
const upstream = 'api.openai.com' | |
// Custom pathname for the upstream website. | |
const upstream_path = '/' | |
// Website you intended to retrieve for users using mobile devices. | |
const upstream_mobile = upstream | |
// Countries and regions where you wish to suspend your service. |
So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.
-
Database in a browser, a spec (Stepan Parunashvili)
What problem are we trying to solve with a sync system?
-
The web of tomorrow (Nikita Prokopov)
Note
If you want to use pure WSLg, you can try the new WSLg tutorial.
In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, etc, all of them might work flawlessly).
The key component we need to install is the desktop metapackage you want (GNOME, KDE, Xfce, Budgie, etc) and tigervnc-standalone-server
.
For this setup, I will use Ubuntu (20.04, 22.04 and 24.04 are working), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the Sample screenshots section for examples.
object RuntimeUtils { | |
def requestThreadDump: String = { | |
// Get the PID of the current JVM process | |
val selfName = java.lang.management.ManagementFactory.getRuntimeMXBean().getName() | |
val selfPid = selfName.substring(0, selfName.indexOf('@')) | |
// Attach to the VM | |
import com.sun.tools.attach.VirtualMachine | |
import sun.tools.attach.HotSpotVirtualMachine; | |
val vm = VirtualMachine.attach(selfPid); |
const fallback = (text) => { | |
const isIos = navigator.userAgent.match(/ipad|iphone/i); | |
const textarea = document.createElement('textarea'); | |
// create textarea | |
textarea.value = text; | |
// ios will zoom in on the input if the font-size is < 16px | |
textarea.style.fontSize = '20px'; | |
document.body.appendChild(textarea); |
export const fetchAsBlob = url => fetch(url) | |
.then(response => response.blob()); | |
export const convertBlobToBase64 = blob => new Promise((resolve, reject) => { | |
const reader = new FileReader; | |
reader.onerror = reject; | |
reader.onload = () => { | |
resolve(reader.result); | |
}; | |
reader.readAsDataURL(blob); |
import scala.reflect.ClassTag | |
object CartesianProduct { | |
/** | |
* Given an array containing a partial Cartesian product, and an array of | |
* items, return an array adding the list of items to the partial | |
* Cartesian product. | |
* | |
* {{{ | |
* val partialProduct = Array(Array(1, 4), Array(1, 5), Array(2, 4), Array(2, 5)) |