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 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 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 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 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 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 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(); |
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
# clone release branch | |
git clone git@github.com:terra-money/core.git --branch=v0.4.6 | |
# move into dir | |
cd core | |
# build it | |
make install | |
# check that we have the right version... etc |
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
package main | |
import ( | |
"fmt" | |
) | |
type Item struct { | |
TestChan chan int64 | |
} |
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
import pandas as pd | |
# view original data here | |
# https://fred.stlouisfed.org/series/M2SL | |
url = "https://fred.stlouisfed.org/graph/fredgraph.csv?bgcolor=%23e1e9f0&chart_type=line&drp=0&fo=open%20sans&graph_bgcolor=%23ffffff&height=450&mode=fred&recession_bars=on&txtcolor=%23444444&ts=12&tts=12&width=968&nt=0&thu=0&trc=0&show_legend=yes&show_axis_titles=yes&show_tooltip=yes&id=M2SL&scale=left&cosd=1959-01-01&coed=2021-01-01&line_color=%234572a7&link_values=false&line_style=solid&mark_type=none&mw=3&lw=2&ost=-99999&oet=99999&mma=0&fml=a&fq=Monthly&fam=avg&fgst=lin&fgsnd=2020-02-01&line_index=1&transformation=lin&vintage_date=2021-03-10&revision_date=2021-03-10&nd=1959-01-01" | |
df = pd.read_csv(url) | |
#### UNCOMMENT TO ACCOUNT FOR 1.9T | |
#new_total = df.tail(1)["M2SL"].values[0] + 1900.0 | |
#df = df.append(pd.DataFrame([["2021-03-10", new_total]], columns = ["DATE", "M2SL"])) |
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
import pandas as pd | |
import requests | |
CLIENT_ID = "<CLIENT_ID>" | |
CLIENT_SECRET = "<CLIENT_SECRET>" | |
CLIENT_SCOPE = "emsi_open" | |
VERSION = "latest" | |
url = "https://auth.emsicloud.com/connect/token" | |
payload = f"client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&grant_type=client_credentials&scope={CLIENT_SCOPE}" |
NewerOlder