Skip to content

Instantly share code, notes, and snippets.

View buyoh's full-sized avatar
☪️

mai buyoh

☪️
View GitHub Profile
@buyoh
buyoh / 2022pronamaxmas.cpp
Created December 21, 2023 13:25
#クリスマスプロ生ちゃん もみの木をdispmanxだけで描画する https://twitter.com/shonen9th/status/1737826399497666618
// ## Build
// g++ --std=c++17 tree2.cpp -o tree2 -lbcm_host
//
// ## Remarks
// DRM VC4 V3D driver needs to be disabled.
// Open `/boot/config.txt` and commented out `dtoverlay=vc4-fkms-v3d`.
#include "bcm_host.h"
#include <cassert>
@buyoh
buyoh / MHZ19B.ino
Last active July 17, 2023 16:42
Arduino IDE + M5stickCPlus + MHZ19B (co2 concentration)(MHZ19C)
#include <M5StickCPlus.h>
// -------
// https://www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf
// Checksum
// The length of buff must be 9
uint8_t MHZ19B_getCheckSum(const uint8_t* buff) {
uint8_t sum = 0;
for (size_t i = 0; i < 8; ++i) sum += buff[i];
@buyoh
buyoh / Ext.js
Created April 2, 2023 17:54
2023/04/01 エイプリルフールネタです。yukicoderの言語欄に ChatGPT を追加するユーザスクリプトです。
// ==UserScript==
// @name ChatGPT on yukicoder
// @namespace http://app.ukibune.net/
// @version 0.2023.4.1
// @description try to take over the world!
// @author mai buyoh
// @match https://yukicoder.me/problems/*
// @exclude https://yukicoder.me/problems/*/submit
// @exclude https://yukicoder.me/problems/*/submissions
// @exclude https://yukicoder.me/problems/*/code
@buyoh
buyoh / 2023pronamachoco.md
Last active February 14, 2023 17:16
#チョコプロ生ちゃん

チョコプロ生ちゃん

https://twitter.com/shonen9th/status/1625544004917166080

概要

ツイートのコードは ChatGPT が出力したコードで、自分で書いたものではありません。以下にどのようにそのコードを出力させたか、ログを貼り付けます。 h3 のヘッダのタイトルが自分が AI に渡した文章で、それ以外は AI が出力したものです。
それなりの補佐は必要ですが、いい話し相手にはなったと思います。

#define M5STACK_MPU6886
#include <M5Stack.h>
TFT_eSprite g_lcd_buffer(&M5.Lcd);
void setup() {
M5.begin();
Serial.begin(115200);
Wire.begin();
@buyoh
buyoh / http.rb
Created March 15, 2021 16:03
easy snippet (HTTP,HTTPS,get,post,put,delete,...)
require 'net/http'
def action_http(uri_str, metho = 'get', field = {}, body = nil, content_type = 'application/json')
uri = URI.parse(uri_str)
req = Net::HTTP.const_get(metho.capitalize).new(uri)
field.each { |k, v| req.add_field(k, v) }
if body
req.add_field 'Content-Type', content_type
req.body = body
end
@buyoh
buyoh / MainActivity.java
Last active February 21, 2022 12:12
Android Example MediaExtractor / MediaCodec / MediaSync
package com.example.mediaprac;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Handler;
import android.view.Surface;
import android.view.SurfaceView;
import android.view.TextureView;
{
"window.zoomLevel": 0,
"editor.fontFamily": "'Ubuntu mono'",
"editor.renderWhitespace": "all",
"editor.fontSize": 15,
"C_Cpp.clang_format_style": "file,
"editor.formatOnSave": true,
"editor.formatOnType": true
}
" show linenumber
set number
" vim の矩形選択で文字が無くても右へ進める
set virtualedit=block
" 挿入モードでバックスペースで削除できるようにする
set backspace=indent,eol,start
" 検索結果をハイライト表示
set hlsearch
" インデント幅
set shiftwidth=2
@buyoh
buyoh / matz.md
Last active July 20, 2019 07:06

2019/07/20

  • 由来

  • まつもとゆきひろ(ひらがな)

  • Matz

  • 日経BP技術大賞

  • プリウス等が受賞する中で