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 { Plugin } from 'vite' | |
import fsp from 'node:fs/promises' | |
import { transform } from "esbuild"; | |
import { | |
isDenoSpecifier, | |
mediaTypeToLoader, | |
parseDenoSpecifier, | |
resolveDeno, | |
ResolvedInfo, | |
toDenoSpecifier, |
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
const zeroToEight = [0, 1, 2, 3, 4, 5, 6, 7, 8] | |
const oneToNine = zeroToEight.map(x => x + 1) | |
function rowCoords({ x, y }) { | |
return zeroToEight.map(i => { return { x, y: i } }) | |
} | |
function colCoords({ x, y }) { | |
return zeroToEight.map(i => { return { x: i, y } }) | |
} |
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
protocol DoSomething { | |
func f() | |
} | |
enum Empty {} | |
extension Empty: DoSomething { | |
func f() {} | |
} |
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
// This solver is semi-automaitc and you can see how possibilites are removed through each step. | |
// It turns out that the hard mode has more than one possible solution, so next time when you | |
// are stuck, just try one manually. | |
const zeroToEight = [0, 1, 2, 3, 4, 5, 6, 7, 8] | |
const oneToNine = zeroToEight.map(x => x + 1) | |
function rowCoords({ x, y }) { | |
return zeroToEight.map(i => { return { x, y: i } }) | |
} |
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
// roughly 1.8x of best tuned solution. | |
// quite concerning since I have written a pool manually and added a GC for better cache locality. | |
import Foundation | |
struct Node { | |
var x: Int | |
var y: Int | |
var left: Int = -1 | |
var right: Int = -1 |
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 torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
vocabSize = 30000 | |
hiddenSize = 128 | |
batchSize = 16 | |
seqSize = 128 | |
class Net(nn.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
import Foundation | |
import CoreFoundation | |
import Security | |
/* | |
* Following operations will be supported: | |
* - generate a new keypair | |
* - export an existing keypair in PKCS12 format | |
* - delete an existing keypair | |
* |
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
#!/usr/bin/env stack | |
-- stack runghc --package turtle | |
{-# LANGUAGE OverloadedStrings #-} | |
import qualified Data.Text.IO as T | |
import Turtle | |
exists :: MonadIO io => Text -> io Bool | |
exists cmd = do |
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
#!/bin/sh | |
docker run \ | |
-v $(pwd):/latex \ | |
-v "/Users/selveskii/Library/Application Support/LaTeX/Styles":/styles \ | |
-v "/Users/selveskii/Library/Application Support/LaTeX/Fonts":/fonts \ | |
"minsheng/latex:latest" \ | |
/bin/bash \ | |
-c "export TEXINPUTS=\".:/styles:\"; xelatex $1" |
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 <iostream> | |
#include <atomic> | |
#include <vector> | |
#include <thread> | |
#include <functional> | |
#include <condition_variable> | |
#include <mutex> | |
#include <random> | |
#include <algorithm> | |
#include <tuple> |
NewerOlder