Skip to content

Instantly share code, notes, and snippets.

From https://github.com/codelion/optillm/blob/main/cot_reflection.py

You are an AI assistant that uses a Chain of Thought (CoT) approach with reflection to answer queries. Follow these steps:

  1. Think through the problem step by step within the <thinking> tags.
  2. Reflect on your thinking to check for any errors or improvements within the <reflection> tags.
  3. Make any necessary adjustments based on your reflection.
  4. Provide your final, concise answer within the <output> tags.

  Important: The <thinking> and <reflection> sections are for your internal reasoning process only. 
@pacozaa
pacozaa / image-boxer.py
Created September 19, 2024 08:22
A python script to box the region image after run an ocr region from https://huggingface.co/spaces/Xenova/florence2-webgpu
import json
from PIL import Image, ImageDraw
# Load the input data from a JSON string
input_data = '''
{
"labels": [
"Active markets",
"Powered by Al | Data Retrived just now",
[
{"ph":"M","args":{"name":"primary"},"ts":1674018165646000,"tid":0,"pid":6803,"name":"process_name"},
{"ph":"M","args":{"sort_index":0},"ts":1674018165646000,"tid":0,"pid":6803,"name":"process_sort_index"},
{"ph":"M","args":{"name":"lifecycle"},"ts":1674018165646000,"tid":0,"pid":6803,"name":"thread_name"},
{"ph":"M","args":{"sort_index":0},"ts":1674018165646000,"tid":0,"pid":6803,"name":"thread_sort_index"},
{"ph":"B","name":"node_modules/.bin/cucumber-js --profile ios -t @ios and not @wip","pid":6803,"tid":0,"cat":"lifecycle","ts":1674018165646000,"args":{"level":10,"cwd":"/Users/sarinsuriyakoon/Documents/palodev/minerva-hk-testing/e2e","data":{"id":"e7ca915d-65b8-fe1f-ea31-b22581d26ee1","detoxConfig":{"configurationName":"ios.sim.debug","apps":{"default":{"type":"ios.app","binaryPath":"../frontend/ios/build/Build/Products/Debug-iphonesimulator/MinervaHK.app","build":"xcodebuild -workspace ../frontend/ios/MinervaHK.xcworkspace -scheme MinervaHK -configuration Debug -sdk iphonesimulator -derivedDataPat
https://unix.stackexchange.com/questions/151682/alternative-command-for-coloured-viewing-the-size-of-all-files-and-folders
@pacozaa
pacozaa / awkFilterEmail.sh
Created November 18, 2022 04:58
Filter the email list
#!/bin/bash
awk '{gsub("<","",$4); gsub(">","",$4); gsub(",","",$4);print $4}' emailList
#!/bin/bash
read -p "Enter port number(ex. 7070): " PORT_NUMBER
echo "Here is $PORT_NUMBER"
if [ "$PORT_NUMBER" = "" ]; then
echo "No port number to target"
exit 0
fi
echo "Finding $PORT_NUMBER .... PID"
PID_FINDING=$(sudo lsof -iTCP -sTCP:LISTEN -n -P | grep $PORT_NUMBER)
#!/bin/bash
echo "Let's look at what you have:"
emulator -list-avds
# emulator @Pixel_2_XL_API_29
read -p "Enter target devices: " DEVICE_NAME
if [ "$DEVICE_NAME" = "" ]
then
emulator @Pixel_2_XL_API_29
else
#!/bin/bash
helpFunction()
{
echo ""
echo "Usage: $0 -a parameterA -b parameterB -c parameterC"
echo -e "\t-a Description of what is parameterA"
echo -e "\t-b Description of what is parameterB"
echo -e "\t-c Description of what is parameterC"
exit 1 # Exit script after printing help
@pacozaa
pacozaa / tleparser.py
Created October 28, 2016 16:17
Parses a NORAD two line element set into a Python dictionary.
def parse_tle_number(tle_number_string):
split_string = tle_number_string.split('-')
if len(split_string) == 3:
new_number = '-' + str(split_string[1]) + 'e-' + str(int(split_string[2])+1)
elif len(split_string) == 2:
new_number = str(split_string[0]) + 'e-' + str(int(split_string[1])+1)
elif len(split_string) == 1:
new_number = '0.' + str(split_string[0])
else:
raise TypeError('Input is not in the TLE float format')
@pacozaa
pacozaa / letsencrypt.md
Created October 24, 2016 10:42 — forked from xrstf/letsencrypt.md
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple: