Skip to content

Instantly share code, notes, and snippets.

View erming's full-sized avatar
Tinkering.

Mattias Erming erming

Tinkering.
  • Software Contractor
  • Sweden
View GitHub Profile
async function withTimeout(fn, ms = 400) {
return new Promise(async (resolve, reject) => {
setTimeout(() => {
reject();
}, ms);
resolve(await fn());
});
}
async function delay(ms = 0) {
import { Fragment } from "preact";
import { useState, useLayoutEffect } from "preact/hooks";
import { createPortal } from "preact/compat";
export default ({ children, into }) => {
const [target, setTarget] = useState(null);
useLayoutEffect(() => {
setTarget(document.querySelector(into));
}, []);
@erming
erming / install-docker.sh
Last active August 22, 2021 13:22
install-docker.sh
#!/bin/bash
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
<template>
<div class="checkbox">
<input type="checkbox" v-model="proxy" :value="value">
</div>
</template>
<script>
export default {
model: {
prop: "model"
ALTER TABLE "table"
ADD CONSTRAINT "c_table_value_json_object"
CHECK "value" IS NULL
OR (JSON_TYPE("value") IS NOT NULL AND JSON_TYPE("value") = 'OBJECT');
Get-AppxPackage *skype* | Remove-AppxPackage
#!/bin/bash
sudo apt install nginx
# mariadb
# https://downloads.mariadb.org/mariadb/repositories/
sudo apt update
sudo apt install mariadb-server
# php
#ifndef _ITOA_H
#define _ITOA_H
#include <stdlib.h>
char* itoa(int i)
{
if (i == 0) {
return "0";
}
CREATE TABLE "dates" (
"id" int auto_increment primary key,
"date" date not null,
"day" int not null
);
SET @i = DATE('2018-01-01');
DELIMITER //
WHILE @i < '2025-01-01' DO
certbot certonly --server https://acme-v02.api.letsencrypt.org/directory --manual --preferred-challenges dns -d 'domain.com,www.domain.com'