Skip to content

Instantly share code, notes, and snippets.

View ABC10946's full-sized avatar

Taisei Kanai ABC10946

View GitHub Profile
@ABC10946
ABC10946 / chat-with-pdf-ollama.py
Last active October 28, 2025 03:32
ollamaを使ってローカルLLMでpdfと対話できるようにしたpythonスクリプト
# source reference: https://github.com/piesauce/llm-playbooks/blob/main/exercises/chapter_1/chat_with_your_pdf/ChatwithyourPDF.ipynb
import os
import traceback
from langchain_community.document_loaders import UnstructuredPDFLoader, PyPDFLoader
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_community.vectorstores import Chroma
from langchain_classic.chains import ConversationalRetrievalChain
from langchain_classic.memory import ConversationBufferMemory
# from langchain_openai import ChatOpenAI
#version=RHEL8
# ignoredisk --only-use=sda
# Partition clearing information
clearpart --none --initlabel
# Use graphical install
# graphical
# Use CDROM installation media
cdrom
text
# Keyboard layouts
package main
import (
"context"
"flag"
"fmt"
"log"
"os"
"github.com/nasa9084/go-switchbot"
@ABC10946
ABC10946 / manage-ssh-key.yaml
Created March 31, 2024 13:58
ssh public key share with github workflow in self hosted runner
name: SSH Key Deploy
run-name: SSH Key Deploy Runner
on: [push]
jobs:
deploy-keys:
runs-on: self-hosted
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Read ssh-pubkey file
@ABC10946
ABC10946 / kcondebug
Created March 30, 2024 04:26
kubernetes debug用Pod
#!/bin/bash
k run shell --image=giantswarm/tiny-tools -it --rm
# This section includes base Calico installation configuration.
# For more information, see: https://projectcalico.docs.tigera.io/master/reference/installation/api#operator.tigera.io/v1.Installation
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
name: default
spec:
# Configures Calico networking.
calicoNetwork:
# Note: The ipPools section cannot be modified post-install.
@ABC10946
ABC10946 / code.py
Created October 5, 2022 13:59
wink switch pico
import digitalio
from board import *
import time
import analogio
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
import usb_hid
kbd = Keyboard(usb_hid.devices)
/*
This sketch introduces how to draw images onto the rgb led matrix
you can create your own images by replacing the values in the 'myPicture'
array. This array holds 64 color values for each pixel in the matrix.
You can take advantage of the draw() and drawDotByDot() functions to
display your own images.
Code written by Patrick Cohen
*/
@ABC10946
ABC10946 / led_lifegame.ino
Created September 7, 2022 15:52
Lifegame on 8x8 WS2812B
#include "FastLED.h"
// Params for width and height
const uint8_t kMatrixWidth = 8;
const uint8_t kMatrixHeight = 8;
#define LED_PIN 3
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
CRGB leds[ NUM_LEDS ];
#define LAST_VISIBLE_LED 63
uint8_t XY (uint8_t x, uint8_t y) {
@ABC10946
ABC10946 / maze.py
Last active July 1, 2022 05:46
迷路生成プログラム(穴掘り方式)
import random
import sys
class Maze:
"""
dir -> 0 右, 1 上, 2 左, 3 下
field cell 0 -> 壁, 1 -> 道
"""
def __init__(self, mazeWidth, mazeHeight):
self.mazeWidth = mazeWidth