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 argparse as ap | |
import dataclasses as dc | |
import multiprocessing as mp | |
import subprocess as sp | |
import sys | |
def parse_args() -> ap.Namespace: | |
p = ap.ArgumentParser("Runs parallel jobs") |
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 | |
# This script installs a Python environment built from source. | |
# Usage: | |
# URL='https://gist.githubusercontent.com/odashi/...copy-paste raw path.../install_local_python.sh' | |
# bash <(curl -sL ${URL}) ./env 3.10.14 64 | |
set -eu -o pipefail | |
if [ $# -ne 3 ]; then | |
>&2 echo "Usage: install_local_python.sh INSTALL_DIR MAJOR.MINOR.PATCH BUILD_THREADS" |
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 | |
url_prefix=https://huggingface.co/datasets/allenai/c4/resolve/1ddc917116b730e1859edef32896ec5c16be51d0/en | |
function download() { | |
dataset_name=$1; shift | |
splits=$1; shift | |
last_split=$(perl -e "print ${splits} - 1") | |
mkdir -p ${dataset_name} | |
for i in $(seq 0 ${last_split}); do |
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
# You may need to install the following libraries: | |
# * google-auth | |
# * requests | |
import json | |
from typing import Any | |
import google.auth | |
import google.auth.credentials | |
import google.auth.transport.requests |
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
"use client"; | |
import { getApp, getApps, initializeApp } from "firebase/app"; | |
import { | |
getAuth, | |
GoogleAuthProvider, | |
signInWithPopup, | |
User, | |
} from "firebase/auth"; | |
import { |
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
load("@pip_deps//:requirements.bzl", "requirement") | |
py_binary( | |
name = "datamodel_codegen", | |
srcs = ["datamodel_codegen_main.py"], | |
main = "datamodel_codegen_main.py", | |
visibility = ["//visibility:public"], | |
deps = [ | |
requirement("datamodel-code-generator"), | |
], |
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
# Sometimes you want to define your FastAPI app within a class for some reason, e.g., | |
# you wanted to initialize the servers at the point you intended, not the point of import. | |
# | |
# In this case, @app.method decorator doesn't work as-is with instance methods due to the | |
# difference of its signature. | |
# | |
# You need to manually call the decorator as a usual function after obtaining self (e.g., | |
# in the __init__ method like below) rather than using the decorator syntax. | |
class MyApp: |
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
!pip install ipywidgets &> /dev/null | |
import ipywidgets as wgt | |
controls = wgt.VBox([]) | |
add_button = wgt.Button(description="Add", icon="plus") | |
pos_prompt_area = wgt.Textarea(placeholder="Positive prompts appear here.") | |
neg_prompt_area = wgt.Textarea(placeholder="Negative prompts appear here.") | |
ui = wgt.VBox([pos_prompt_area, neg_prompt_area, add_button, controls]) | |
def generate_prompt(change): |
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
あまり大きな声で言えないのですが | |
あまり知られてないのですが | |
ありえない | |
あんまり言いたくないけど | |
いい加減にしてほしい | |
いい歳してお恥ずかしいのですが | |
悪用厳禁なのですが | |
安心してください | |
言いたくない過去を言うと | |
言わせてください |
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 datetime | |
import logging | |
import os | |
from google.cloud import logging as cloud_logging | |
import tweepy | |
THRESHOLD_DAYS = 3 | |
BATCH_SIZE = 25 |
NewerOlder