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 llama_index.vector_stores.simple import SimpleVectorStoreData, SimpleVectorStore | |
from llama_index.indices.vector_store import GPTVectorStoreIndex | |
from llama_index.data_structs.data_structs_v2 import SimpleIndexDict | |
from llama_index.docstore.simple_docstore import SimpleDocumentStore | |
def merge_vector_indices(vector_indices): | |
""" | |
Merges multiple instances of GPTSimpleVectorIndex from | |
the LlamaIndex (0.5.27) library into a single GPTVectorStoreIndex instance. |
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
def event_usage(self, task_id, since, until, interval="1m"): | |
interval_ms = 60000 # 1 minute | |
quantize = lambda t: (t // interval_ms) * interval_ms | |
q_since, q_until = quantize(since), quantize(until) | |
# --- scripts --- | |
quantize_closure = "quantize = { it.intdiv(interval_ms) * interval_ms }\n" | |
script = {} | |
script['init'] = """ |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 png | |
f = open('icon.png', 'wb') | |
w = png.Writer(1, 1, greyscale=True) | |
w.write(f, [[240]]) | |
f.close() |
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
# -*- coding: utf-8 -*- | |
import codecs | |
import HTMLParser | |
import sys | |
import re | |
import bz2 | |
DEBUG = False |
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 | |
mecab="mecab-0.996" | |
mecab_python="mecab-python-0.996" | |
mecab_googlecode="https://mecab.googlecode.com/files/" | |
if ! type curl > /dev/null; then | |
downloader='wget ' | |
else | |
downloader='curl -O ' |
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
# -*- coding: utf-8 -*- | |
def all_startswith(question, d): | |
for num in d: | |
if question.startswith(num): | |
yield num | |
def pickup(string, d, result=[]): | |
if string == "": | |
print result, ''.join([d[num] for num in result]) |
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
# -*- coding: utf-8 -*- | |
import json | |
from datetime import datetime, timedelta | |
ROBOT_RECORD = "RobotRecord" | |
RECORD_KINDS = ('AFSMData', 'Compass', 'FaceMotionData', 'OmniControl', 'RSSIRecord', 'URGData') | |
FILENAME_PREFIX = "2012-08-31 11:00:00+09:00_2012-08-31 17:10:00+09:00_" |
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
#!/Users/buhii/.virtualenvs/gemini/bin/python | |
# -*- coding: utf-8 -*- | |
import os | |
from path import path | |
IMAGE_EXTENSIONS = ('png', 'jpg', 'gif', 'pdf') | |
d = path('.') |
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
#!/Users/buhii/.virtualenvs/gemini/bin/python | |
# -*- coding: utf-8 -*- | |
import sys | |
if len(sys.argv) != 2: | |
print "Usage: framed.py [image path]" | |
sys.exit(0) | |
else: | |
import os |
NewerOlder