Skip to content

Instantly share code, notes, and snippets.

@oquno
oquno / chatgpt2scrapbox.py
Created April 20, 2023 10:01
GPT-4 に大体書いてもらった、ChatGPT からエクスポートした conversations.json を input.json として置いておくと Scrapbox インポート用の output.json を出力してくれるスクリプト
import json
USERNAME="oquno"
def get_ordered_nodes(mapping, current_node):
node_data = mapping[current_node]
children = node_data['children']
ordered_nodes = []
@oquno
oquno / chatgptlog2html.js.bookmarklet
Last active April 14, 2023 01:59
ChatGPTに相談して書いてもらったチャットログをHTML出力するために実行するブックマークレットを手直ししたもの
javascript:(function() {
const userStyle = 'font-weight: bold; color: blue;';
const aiStyle = 'font-weight: bold; color: green;';
const messages = document.querySelectorAll(".flex .flex-col .items-start.gap-4");
let chatHistory = '';
messages.forEach(message => {
const role = message.childNodes[0].classList && message.childNodes[0].classList.contains('markdown') ? 'ChatGPT' : 'ユーザー';
const style = role === 'ユーザー' ? userStyle : aiStyle;
chatHistory += `<p><span style="${style}">${role}: </span>${message.innerHTML}</p>`;
@oquno
oquno / rest.yaml
Last active February 8, 2023 03:44
https://gist.github.com/oquno/d07f6dbf8cc760f2534d9914efe79801 の JSON を Home Assistant に取り込む config
resource: http://RASPI/sensor.json
method: GET
scan_interval: 30
sensor:
- name: UD CO2
unique_id: ud1_co2
value_template: "{{ value_json.stat.co2ppm }}"
unit_of_measurement: "ppm"
state_class: measurement
device_class: carbon_dioxide
@oquno
oquno / udco2s.py
Last active March 5, 2024 08:58
UD-CO2S にシリアル接続してデータを JSON ファイルに上書きし続けるスクリプト
import json, datetime, re, serial, io
class UDCO2S:
def __init__(self, dev="/dev/ttyACM0"):
self.dev = dev
def start_logging(self, log_file):
regex = re.compile(r'CO2=(?P<co2>\d+),HUM=(?P<hum>\d+\.\d+),TMP=(?P<tmp>-?\d+\.\d+)')
with serial.Serial(self.dev, 115200, timeout=6) as conn:
conn.write("STA\r\n".encode())
@oquno
oquno / oquno.js
Last active November 21, 2020 19:57
name card for Pixl.js
require('Font8x12').add(Graphics);
g.clear();
g.setFontVector(20);
g.drawString("oquno", 62, 10);
g.setFont8x12();
g.drawString("http://oq.la", 62, 35);
g.setFontVector(9);
g.drawString("07064591176", 62, 48);
var image = {
@oquno
oquno / last.fm journal 下書き
Last active November 13, 2019 18:10
Last.fmのjournalが2015年8月から更新できないので下書き
■8/1 西院ミュージックフェス@さいばば
[artist]音に敏感[/artist]
→ [url]http://oquno.com/3290[/url]
■8/1 お疲れSUMMER OF PANPAN~大阪編~@十三ファンダンゴ
[artist]パンパンの塔[/artist] # 2回目
[artist]3markets[][/artist]
[artist]The キャンプ[/artist] # 2回目
[artist]山田エリザベス 良子[/artist] # 21回目
[artist]モケーレムベンベ[/artist]
@oquno
oquno / todo.md
Last active December 31, 2015 07:29
今日のTODO
  • ティッシュ買う
  • 大森靖子/絶対少女 買う
  • ゆべし買う
@oquno
oquno / TODO.mkd
Created November 2, 2013 00:40
今日のTODO
  • 洗濯槽カバー買う
  • 卵買う
  • フレンチトースト作る
  • 色々洗濯する
@oquno
oquno / shiftjis.user.js
Created September 28, 2013 16:57
Shift_JIS に文字コード変え太郎
// ==UserScript==
// @name Shift_JIS に文字コード変え太郎
// @namespace http://oq.la
// @include https://hogehoge.com/hogehoge/*
// ==/UserScript==
var tags = ['head', 'HEAD'];
for (var i = 0; i < tags.length; i++)
{
if (document.getElementByTagName(tags[i]).length > 0)
@oquno
oquno / سمَـَّوُوُحخ ̷̴̐خ ̷̴̐خ ̷̴̐خ امارتيخ ̷̴̐خ
Created September 2, 2013 09:20
سمَـَّوُوُحخ ̷̴̐خ ̷̴̐خ ̷̴̐خ امارتيخ ̷̴̐خ
سمَـَّوُوُحخ ̷̴̐خ ̷̴̐خ ̷̴̐خ امارتيخ ̷̴̐خ