Skip to content

Instantly share code, notes, and snippets.

@nomissbowling
nomissbowling / first_step_crosscompile.md
Created November 4, 2022 11:55 — forked from kjunichi/first_step_crosscompile.md
クロスコンパイル入門

背景

もともとは、DLLをオープンしてシンボル参照して、必要な関数を呼ぶ形式にすれば、簡単にmruby-webcam (OpenCVの力を借りてWebCamの画像を表示する)のマルチプラットフォーム対応のバイナリが作成出来ると考えていた。

しかし、OpenCVは32ビット環境では最新版ではWebCamが扱えない状態C++ APIを使う必要がある

さらに悪いことc++はdlopenやLoadLibraryではマングリング問題やnewやdeleteのラッパーが必要で簡単には使えない。 JulialangでC++の関数の呼び出しがサポートされていることを知るも、これも、完全なものではなく、せいぜい マングリングを解決する程度のものであった。

@nomissbowling
nomissbowling / file0.txt
Created November 3, 2022 06:23 — forked from KTakahiro1729/file0.txt
Nim Tutorial Part Iを日本語訳してみた(前編) ref: https://qiita.com/KTakahiro1729/items/f4776f3a072c01f9086b
# これはコメントである
echo "お名前は? "
var name: string = readLine(stdin)
echo "やあ、", name, "!"
@nomissbowling
nomissbowling / gist:f003d6f2ce245404e5c84993d3690130
Created October 22, 2022 07:08 — forked from timakin/gist:34255f56dd5595cee421
Gitのsubtreeについてのまとめ

前提

  • まとめた目的
    • プロジェクトのルートディレクトリにsubtree先を展開できないかなーという話を検証したので、その記録
      subtreedDir/
        /A
        /B
      とかがあるとき、それをsubtreeとして呼び出す、childプロジェクトがあるとする。このとき、
    

child/

import os
type
TUtf16Char = distinct int16
WideCString = ptr array[0.. 1_000_000, TUtf16Char]
const
utf8Encoding = 65001
proc len(w: WideCString): int =
#[
Author: Ward
Example of GetUserName
References:
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getusernamea
]#
import winim/lean
@nomissbowling
nomissbowling / avi2avi.cpp
Created August 18, 2022 03:29 — forked from kimoto/avi2avi.cpp
無圧縮AVIを、任意のコーデックで圧縮するコード
/*
* 無圧縮AVIファイル"input.avi"を
* GUIで選択した圧縮形式で圧縮して、"output.avi" に出力するだけのプログラム
*/
#include <Windows.h>
#include <tchar.h>
#include <Vfw.h>
#pragma comment(lib, "vfw32.lib")
#include <GdiPlus.h>
@nomissbowling
nomissbowling / detect_color_position.py
Created August 8, 2022 22:42 — forked from TonyMooori/detect_color_position.py
特定の色の座標を抽出するプログラム
import cv2
import numpy as np
# 0 <= h <= 179 (色相) OpenCVではmax=179なのでR:0(180),G:60,B:120となる
# 0 <= s <= 255 (彩度) 黒や白の値が抽出されるときはこの閾値を大きくする
# 0 <= v <= 255 (明度) これが大きいと明るく,小さいと暗い
# ここでは青色を抽出するので120±20を閾値とした
LOW_COLOR = np.array([100, 75, 75])
HIGH_COLOR = np.array([140, 255, 255])
@nomissbowling
nomissbowling / json.cpp
Created July 29, 2022 06:49 — forked from yohm/json.cpp
basic usage of nlohmann-json
#include <iostream>
#include <fstream>
#include <nlohmann/json.hpp>
// for convenience
using json = nlohmann::json;
namespace ns {
// a simple struct to model a person
struct person {
# https://gist.github.com/FranzDiebold/898396a6be785d9b5ca6f3706ef9b0bc
# https://gist.github.com/okld/0aba4869ba6fdc8d49132e6974e2e662
# https://github.com/komodovaran/stateful_streamlit_enterprise/tree/master/src
from streamlit.report_thread import get_report_ctx
from streamlit.server.server import Server
from streamlit.hashing import _CodeHasher
class _SessionState:
@nomissbowling
nomissbowling / SessionState.py
Created July 21, 2022 12:05 — forked from tvst/SessionState.py
DO NOT USE!!! Try st.session_state instead.
"""Hack to add per-session state to Streamlit.
Usage
-----
>>> import SessionState
>>>
>>> session_state = SessionState.get(user_name='', favorite_color='black')
>>> session_state.user_name
''