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-US"> | |
<head> | |
<title>Directory Access Proof-of-Concept</title> | |
<script> | |
const trailerSignature = new Uint8Array([0x50, 0x4b, 0x05, 0x06]); // "End of Central Directory" record | |
const showPicker = async () => { | |
// find assets0.pk3 |
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 asynchttpserver, asyncdispatch | |
from strformat import `&` | |
proc main() = | |
let local = "123" | |
proc serveIndex(req: Request) {.async, gcsafe.} = | |
await req.respond(Http200, &"{local}") | |
proc serve404(req: Request) {.async, gcsafe.} = |
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 asynchttpserver, asyncdispatch | |
from strformat import `&` | |
let name = "Willi" | |
proc serveIndex(req: Request) {.async.} = | |
await req.respond(Http200, &"hello {name}") | |
let server = newAsyncHttpServer() | |
discard server.serve(Port(8080), serveIndex, address = "127.0.0.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
type | |
Boolable = concept x | |
if x: discard | |
Bool = concept x | |
x is bool | |
when isMainModule: | |
type MyInt = distinct int | |
converter toBool(x: MyInt): bool = int(x) != 0 | |
doAssert(MyInt is Boolable) |
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
in Visual Studio Code with https://play.nim-lang.org/?gist=e609c6c728d4cbf8751f0cf618d4df0e I got these errors: | |
type mismatch: got <int64> but expected 'bool' | |
type mismatch: got <Flags, set[range 0..65535(int)]> | |
but expected one of: | |
proc `==`(x, y: int32): bool | |
first type mismatch at position: 1 | |
required type: int32 |
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
module Main where | |
main :: IO () | |
main = interact $ \ input -> | |
let (serializedTree:encodedMessages) = lines input | |
tree = deserialize serializedTree | |
messages = map (decode tree) encodedMessages in | |
unlines messages | |
data PrefixTree = Leaf Char | Node PrefixTree PrefixTree |
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
module Main( main ) where | |
data PolishElement = PolishPlus | PolishNumber Integer deriving (Show) | |
polish :: [PolishElement] -> (Integer, [PolishElement]) | |
polish (PolishNumber x : tail) = (x, tail) | |
polish (PolishPlus : tail) = (x + y, tail'') | |
where | |
(x, tail') = polish tail | |
(y, tail'') = polish tail' |
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
/* | |
main = interact(decode tail(lines) ctree . head . lines) | |
-- the parens here are misleading, this is really just: | |
main = interact(decode tail lines ctree . head . lines) | |
-- which comes down to this due to operator precedence: | |
main = interact((decode tail lines ctree) . head . lines) | |
*/ | |
int main() | |
{ |
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
#pragma once | |
#include <array> | |
#include <utility> | |
#include <cassert> | |
#include <cstddef> | |
#include <algorithm> | |
#include "qcommon/q_platform.h" |
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
#pragma once | |
#include <cstddef> | |
#include <cctype> | |
#include <algorithm> | |
#include <istream> | |
#include <streambuf> | |
#include <utility> | |
#include "gsl.h" |
NewerOlder