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 langchain_community.chat_models import ChatOpenAI | |
from llama_index import SimpleDirectoryReader | |
from llama_index import GPTVectorStoreIndex, LLMPredictor, ServiceContext, PromptHelper, load_index_from_storage, StorageContext | |
import gradio as gr | |
def init_index(directory_path): | |
# model params - refer docs | |
max_input_size = 4096 | |
num_outputs = 512 | |
chunk_size_limit = 600 |
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
#!/usr/bin/env python3 | |
# Based on: David Manouchehri <manouchehri@protonmail.com> | |
# Echo bytes from UDP port to stdout, treating as utf-8 | |
import socket | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
server_address = '0.0.0.0' | |
server_port = 22222 |
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 sys | |
# | |
# Find the bands a SIM7670 modem is using | |
# First, get the LTE bitcode from via the command | |
# AT+CNBP? | |
# The second number is the LTE bands in bitcode format | |
# The number is a 64-bit hex number from the command-line (such as 0X00010A000 or 0X00010A000) | |
# This script will parse it and display the bands indicated |
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
class IgnoranceMixin: | |
""" | |
Use as first parent, like: | |
``` | |
class InfluxQuery(IgnoranceMixin, JsonModel): | |
... | |
``` | |
Basic calls (get,set,init), try to call Redis but silently | |
fallover to doing nothing upon connection errors |
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
# | |
# Hardware setup | |
# | |
# - plug in wifi dongle. It will connect as a station to an upstream access point: wlan1(STA) | |
# - onboard wifi is wlan0. It will be an access point. It will forward traffic to wlan1. | |
# Update system if required | |
echo Warning: updating system. This might take a while. | |
sudo apt update -y | |
sudo apt upgrade -y |
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
[Unit] | |
Description=Heartbeat | |
After=systemd-networkd-wait-online.service | |
# Try to restart forever! | |
StartLimitIntervalSec=0 | |
StartLimitInterval=0 | |
[Service] | |
# root to control led and reboot |
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
#!/usr/bin/env python3 | |
# | |
# PiZero : flash LED depending on 'net connection. Reboot after 1 hour disconnected. | |
# | |
from subprocess import run | |
from time import sleep | |
import socket | |
from datetime import datetime as dt |
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/sh | |
## non-interactive config | |
sudo raspi-config nonint do_wifi_country au | |
## software | |
sudo apt update && sudo apt dist-upgrade -y | |
sudo apt install vim git -y | |
sudo apt install -y autossh |
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/sh | |
if [ $# -ne 1 ] | |
then | |
echo "Wrong args" | |
echo "write-pi-sd.sh <device> | |
echo <device> such as "/dev/sdc" for a SD card | |
exit 1 | |
fi |
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
- install Ubuntu Desktop 20 | |
-- minimal install | |
-- LVM | |
- install ssh | |
sudo apt install openssh-server | |
- now can remote in | |
scp -r .ssh server-name | |
ssh server-name |
NewerOlder