Skip to content

Instantly share code, notes, and snippets.

import tiktoken
class ChatSession:
"""
A class to manage a chat session with an API, including maintaining history and token counting.
Attributes:
__model (str): The model name used for API calls.
__history (list): The list of messages in the chat history.
client: The API client instance.
#!/bin/env bash
cp -r /home/.ssh/* /root/.ssh/
cp -r /home/.gitconfig /root/.gitconfig
cp -r /home/.conda_envs/nerfstudio /opt/conda/envs/
(
cd /home/nerfstudio
git pull
)
#!/bin/env bash
cp -r /home/.ssh /root/
#cp -r /home/.conda_envs/nerfstudio /opt/conda/envs/
cp -r /home/.conda_envs/snerg3.8 /opt/conda/envs/
#(
# cd /home/nerfstudio
# git pull
#)
#!/bin/sh
cd /notebooks/dl_experiments
git add .
git commit -m "Commit"
git push origin master
cd /notebooks/web
git add .
git commit -m "Commit"
#!/bin/sh
# run it from /storage/pre_run.sh in paperspace fastai container
# setup git user
git config --global user.email "misza222@gmail.com"
git config --global user.name "Michal Pawlowski"
# download and setup cmd utils
-------------------------------------------------
nench.sh v2017.06.01 -- https://git.io/nench.sh
benchmark timestamp: 2018-02-28 16:17:56 UTC
Digital Ocean 4 GB 2 vCPUs 25 GB 5 TB $40/mo
-------------------------------------------------
Processor: Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz
CPU cores: 2
Frequency: 2693.674 MHz
RAM: 3.9G
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@misza222
misza222 / iterative_deepening.py
Created June 1, 2017 08:12
Iterative deepening timeout example in python for *nix
import signal
import time
class TimeOut():
"""
TimeOut for *nix systems
"""
class TimeOutException(Exception):
pass

Turn on/off a LED from a web page

VIDEO

# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
LCONF_VERSION = "6"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/usr/local/storage/misza/yocto/galileo_iot-devkit/iotdk_src_140220/meta \
/usr/local/storage/misza/yocto/galileo_iot-devkit/iotdk_src_140220/meta-oe \