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
# /// script | |
# dependencies = [ | |
# "numpy", | |
# "torch", | |
# "kernels", | |
# ] | |
# /// | |
import torch |
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
# /// script | |
# dependencies = [ | |
# "requests<3", | |
# ] | |
# /// | |
import requests | |
import concurrent.futures | |
import time | |
from datetime import datetime |
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
// Roku device IP address | |
const rokuIp = "192.168.1.252"; | |
// Base URL for ECP commands | |
const baseUrl = `http://${rokuIp}:8060/keypress`; | |
// Delay between commands in milliseconds | |
const delay = 3000; | |
async function sendKeypress(command) { | |
try { | |
const response = await fetch(`${baseUrl}/${command}`, { method: 'POST' }); |
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
from collections import deque | |
import time | |
from dataclasses import dataclass | |
from typing import Deque, List, Dict | |
import requests | |
import os | |
class Colors: | |
PURPLE = "\033[95m" |
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
from openai import OpenAI | |
ENDPOINT_URL = "ENDPOINT_URL" | |
HF_TOKEN = "YOUR_TOKEN" | |
# Initialize the client, pointing it to one of the available models | |
client = OpenAI( | |
base_url=ENDPOINT_URL + "/v1/", | |
api_key=HF_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
const SEND_IN_BLUE_KEY = "..." | |
const randomString = (length) => { | |
const bytes = new Uint8Array(length); | |
window.crypto.getRandomValues(bytes); | |
let result = ''; | |
bytes.forEach((b) => { | |
// Convert each byte to a digit (0-9) | |
result += (b % 10).toString(); | |
}); |
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
tell application "Safari" | |
-- Open Slack and navigate to the desired channel | |
activate | |
-- Navigate to the desired channel (with Josh in the name) | |
tell window 1 | |
set currentTab to tab 1 | |
set URL of currentTab to "https://app.slack.com/client/SPACE/CHAN" | |
repeat until (do JavaScript "document.readyState" in currentTab) is "complete" | |
delay 0.2 |
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
curl -OL http://nginx.org/download/nginx-1.23.4.tar.gz | |
tar -xvzf nginx-1.23.4.tar.gz && rm nginx-1.23.4.tar.gz | |
# todo add openssl and prce | |
curl -OL https://osdn.net/projects/sfnet_pcre/downloads/pcre/8.45/pcre-8.45.tar.gz | |
tar -xvzf pcre-8.45.tar.gz && rm pcre-8.45.tar.gz | |
curl -OL https://github.com/openssl/openssl/releases/download/openssl-3.1.0/openssl-3.1.0.tar.gz | |
tar -xvzf openssl-3.1.0.tar.gz && rm openssl-3.1.0.tar.gz |
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
// our DO class | |
export class SomeDurableObject { | |
// should upgrade to explicit type in prod | |
env: any; | |
constructor(_controller, env) { | |
this.env = env; | |
} | |
// manually make request to D1 binding |
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 { ApiPromise, Keyring, WsProvider } from "@polkadot/api"; | |
async function main() { | |
const wsProvider = new WsProvider("wss://rpc.parallel.fi"); | |
const api = await ApiPromise.create({ provider: wsProvider }); | |
// no blockHash is specified, so we retrieve the latest | |
const signedBlock = await api.rpc.chain.getBlock(); |
NewerOlder