Skip to content

Instantly share code, notes, and snippets.

View thekitchenscientist's full-sized avatar

thekitchenscientist

View GitHub Profile
@thekitchenscientist
thekitchenscientist / power_of_ten_workflow
Last active January 9, 2024 15:10
A comfyUI node layout for nesting latents within latents
{
"last_node_id": 792,
"last_link_id": 458,
"nodes": [
{
"id": 1,
"type": "CheckpointLoaderSimple",
"pos": [
100,
130
@thekitchenscientist
thekitchenscientist / mistral_chat.py
Created October 17, 2023 07:46
Simple chat using dolphin-2.1-mistral-7b with a 16k context window, streamlit and llama_cpp
# -*- coding: utf-8 -*-
"""
Spyder Editor
@author: thekitchenscientist
"""
# Import streamlit library
import streamlit as st
from llama_cpp import Llama
@thekitchenscientist
thekitchenscientist / gist:56969191bd2f33849fb2dfa10cfae0d9
Created October 14, 2023 17:30
Recreation of textfx.withgoogle.com locally using dolphin-2.1-mistral-7b, llama-cpp-python and streamlit
# -*- coding: utf-8 -*-
"""
Prompts by Google https://github.com/google/generative-ai-docs/tree/main/demos/palm/web/textfx
@author: thekitchenscientist and Bing Chat (conversion of prompts and basic app framework)
"""
class TextFX:
# Initialize the list attribute with an empty list
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
<Window x:Class="LegoLogger.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:LegoLogger"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="550">
<Grid Loaded="Grid_Loaded">
<Grid.ColumnDefinitions>
@thekitchenscientist
thekitchenscientist / EV3pyHexConversion.py
Created August 20, 2015 19:45
EV3py using python hex conversion rather than library
import serial
EV3 = serial.Serial('/dev/rfcomm0')
textstring = "2C000000800000841300820000820000841C018200008232008475692F6D696E6473746F726D732E726766008400"
command = textstring.decode("hex")
print(command)
EV3.write(command)
import serial
from dec_to_hex import h # decimal-to-hexadecimal dictionary
EV3 = serial.Serial('/dev/rfcomm0')
# message length
bytecount = h[44] #look up 44 in hex dictionary
comm_0 = '\x00'
@thekitchenscientist
thekitchenscientist / EV3pyDirectCommand.py
Created August 20, 2015 19:36
A simple test of direct commands using ev3py (https://github.com/thiagomarzagao/ev3py).
#import modules
import time
from ev3py import ev3
#create a reference to the ev3 called 'mybrick'
mybrick = ev3()
# connect with EV3 via Bluetooth
mybrick.connect('bt')
@thekitchenscientist
thekitchenscientist / EV3ControlMotor.py
Created August 20, 2015 19:31
Basic motor control by direct command on Linux
import time
# command to start motor on port A at speed 20
start_motor = '\x0C\x00\x00\x00\x80\x00\x00\xA4\x00\x01\x14\xA6\x00\x01'
# command to stop motor on port A
stop_motor = '\x09\x00\x01\x00\x80\x00\x00\xA3\x00\x01\x00'
# send commands to EV3 via bluetooth
with open('/dev/rfcomm0', 'w', 0) as bt:
@thekitchenscientist
thekitchenscientist / EV3playtone.py
Created August 20, 2015 19:29
Send a note to an EV3 brick from Linux
play_tone = '\x0F\x00\x00\x00\x80\x00\x00\x94\x01\x81\x02\x82\xE8\x03\x82\xE8\x03'
# send commands to EV3 via bluetooth
with open('/dev/rfcomm0', 'w', 0) as bt:
bt.write(play_tone)