This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>cannon.js - container demo</title> | |
<link rel="stylesheet" href="css/style.css" type="text/css" /> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" /> | |
</head> | |
<body> | |
<script type="module"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <cuda_runtime.h> | |
#ifndef CUDA_H | |
#define CUDA_H | |
// https://stackoverflow.com/a/27992604 | |
#ifdef __INTELLISENSE__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://medium.com/swlh/deploy-your-private-docker-registry-as-a-pod-in-kubernetes-f6a489bf0180 | |
docker run --rm --entrypoint htpasswd registry:2.6.2 -Bbn docker docker > auth/htpasswd | |
kubectl create secret tls certs-secret --cert=/mnt/d/Programs/nginx-1.17.1/conf/yff.me/fullchain.pem --key=/mnt/d/Programs/nginx-1.17.1/conf/yff.me/privkey.pem | |
kubectl create secret generic auth-secret --from-file=auth/htpasswd | |
cat > deploy.yaml << EOF | |
apiVersion: v1 | |
kind: PersistentVolume | |
metadata: | |
name: docker-repo-pv | |
spec: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Client, Keyboard, Mouse, WebSocketTunnel } from 'guacamole-common-js' | |
async function start() { | |
const req = await fetch('/token'), | |
token = await req.text(), | |
client = new Client(new WebSocketTunnel(`http://localhost:8088/?token=${token}`)), | |
elem = client.getDisplay().getElement() | |
document.body.appendChild(elem) | |
client.connect({ }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react' | |
import ReactDOM from 'react-dom' | |
/** @type { (fcs: number[][]) => number[][] } */ | |
function getLoops(fcs) { | |
/** @type { { [k: string]: number } } */ | |
const faceNum = { } | |
for (const [a, b, c] of fcs) { | |
for (const [i, j] of [[a, b], [b, c], [c, a]]) { | |
const e = [i, j].sort().join('/') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include "cuda_runtime.h" | |
#include "cuda_fp16.h" | |
// https://stackoverflow.com/a/27992604 | |
#ifdef __INTELLISENSE__ | |
typedef struct xyz { | |
int x; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
async def execBatch(next, exec, concurrency=5): | |
running = [None] * concurrency | |
torun = await next([], running) | |
dones = [] | |
async def schedule(): | |
while len(torun) > 0 or len(dones) > 0 or len([task for task in running if task]) > 0: | |
if len(dones) > 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from random import random, choices | |
def clip(x, x0, x1): | |
return x0 if x < x0 else x1 if x > x1 else x | |
def make_masks(geneSize, popSize, crossoverNum): | |
mask0 = [0] * geneSize | |
mask1 = [int(i / int(geneSize / crossoverNum)) % 2 for i in range(geneSize)] | |
mask2 = [-x for x in mask1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function reduce(arr, fn) { | |
let tasks = arr.map(item => ({ item })), | |
reqs = [] | |
while (true) { | |
if (tasks.length === 1) { | |
return tasks[0].item | |
} | |
const toRun = tasks.filter(task => !task.started) | |
for (let i = 0; i + 1 < toRun.length; i += 2) { | |
const [a, b] = toRun.slice(i, i + 2) |