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" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Cet ci pi ti</title> | |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> | |
<style> | |
:root { | |
/* Light theme variables */ |
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 Cocoa | |
import WebKit | |
struct Options { | |
var html: String = "" | |
var url: URL? = nil | |
var title: String = "HTML Viewer" | |
var width: CGFloat = 800 | |
var height: CGFloat = 600 | |
var env: String = "{}" // Default empty JSON object |
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 Cocoa | |
import CoreGraphics | |
@_silgen_name("CGSMainConnectionID") | |
func CGSMainConnectionID() -> CGSConnection | |
@_silgen_name("CGSCopyManagedDisplaySpaces") | |
func CGSCopyManagedDisplaySpaces(_ connection: CGSConnection) -> CFArray | |
typealias CGSConnection = UInt32 |
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
package main | |
import ( | |
"context" | |
"fmt" | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"os" |
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 http.server | |
import socketserver | |
import threading | |
import urllib.parse | |
def wait_for_oauth_callback(port: int = 9090) -> str: | |
code: str | None = None | |
class CallbackHandler(http.server.SimpleHTTPRequestHandler): |
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 Subscriber struct { | |
send chan string | |
} | |
type Hub struct { | |
clients map[*Subscriber]bool | |
broadcast chan string | |
register chan *Subscriber | |
unregister chan *Subscriber | |
} |
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
using System; | |
using System.IdentityModel.Tokens.Jwt; | |
using System.Threading.Tasks; | |
using Microsoft.Extensions.Caching.Memory; | |
namespace JwtUtils | |
{ | |
public interface IJwtCache | |
{ | |
void Set(string key, JwtSecurityToken token); |
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 python3 | |
import httpx | |
import subprocess | |
import logging | |
import typer | |
from pathlib import Path | |
logging.basicConfig( | |
level=logging.DEBUG, | |
format="%(levelname)s %(asctime)s: %(message)s", |
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
services.AddSwaggerGen(c => | |
{ | |
// ... | |
c.AddSecurityDefinition("bearer", new OpenApiSecurityScheme | |
{ | |
Description = | |
"Authenticate with an existing JWT token. **Prefix the token with `Bearer`, i.e. `Bearer eyJ...`**", | |
In = ParameterLocation.Header, | |
Name = HeaderNames.Authorization, |
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 dataclasses | |
import functools | |
import io | |
import pathlib | |
from datetime import timedelta, datetime | |
from io import FileIO | |
from typing import Callable | |
import httpx |
NewerOlder