This file contains 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
from enum import Enum | |
from typing import Any, Optional | |
class TokenType(Enum): | |
NUMBER = 1 | |
BANG = 2 | |
CARET = 3 | |
STAR = 4 | |
SLASH = 5 | |
PLUS = 6 |
This file contains 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 <fcntl.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#define CAT_IMPL(x, y) x##y | |
#define CAT(x, y) CAT_IMPL(x, y) | |
#define defer DEFER_IMPL(CAT(defer__, __COUNTER__)) | |
#define DEFER_IMPL(name) auto void name (void*); \ |
This file contains 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 <string.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#define PORT 42069 |
This file contains 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
/** | |
* host1$ make select && ./select | |
* host1$ telnet host1 6969 | |
* host2$ telnet host1 6969 | |
* ... | |
* ??? | |
* profit | |
*/ | |
#include <errno.h> | |
#include <stdio.h> |
This file contains 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
// $ make simple && ./simple & | |
// $ telnet localhost 6969 | |
#include <netdb.h> | |
#include <netinet/in.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <strings.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> |
This file contains 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/bash | |
# Usage: | |
# $ sh mkcert example.com | |
set -euo pipefail | |
main() { | |
DOMAIN="$1" | |
local key="${KEY:-$DOMAIN.pem}" |
This file contains 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
Attaching to zkevm-pool-db, zkevm-prover, zkevm-rpc, zkevm-state-db, zkevm-sync | |
zkevm-pool-db | | |
zkevm-pool-db | PostgreSQL Database directory appears to contain a database; Skipping initialization | |
zkevm-state-db | | |
zkevm-pool-db | | |
zkevm-state-db | PostgreSQL Database directory appears to contain a database; Skipping initialization | |
zkevm-state-db | | |
zkevm-sync | Version: v0.3.3 | |
zkevm-sync | Git revision: d36d1d3 | |
zkevm-sync | Git branch: HEAD |
This file contains 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/bash | |
# Usage: | |
# EMAIL='you@example.com' PASSWORD='your password' bash api_v2_getting_started.sh | |
TOKEN= | |
GET() { | |
curl -s -H 'content-type: application/json' \ | |
-H "authorization: Bearer ${TOKEN}" \ |
This file contains 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
CC = clang | |
CFLAGS += -Iinclude | |
main: src/main.o | |
$(CC) $(CFLAGS) -o main src/main.o |
This file contains 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
set -euxo pipefail | |
PROVIS_PATH="$HOME/provis" | |
git clone https://github.com/vastus/provis.git ${PROVIS_PATH} | |
make -C ${PROVIS_PATH} common |
NewerOlder