Skip to content

Instantly share code, notes, and snippets.

@nomissbowling
nomissbowling / Readme.md
Created November 13, 2020 03:06 — forked from mechamogera/Readme.md
C++言語で簡単なRuby拡張ライブラリを書いてみた

この拡張ライブラリの使用手順

  • このサンプルをダウンロードして解凍したディレクトリで以下を実行
 $ ruby extconf.rb
 $ make
 $ ruby test.rb

ファイルについて

@nomissbowling
nomissbowling / extconf.rb
Created November 13, 2020 03:07 — forked from hamajyotan/extconf.rb
Data_Wrap_Struct example
require "mkmf"
$libs += " -lstdc++ "
create_makefile("human")
@nomissbowling
nomissbowling / gibbs-animate.ipynb
Created November 26, 2020 00:45 — forked from terasakisatoshi/gibbs-animate.ipynb
gibbs-animate for gist
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nomissbowling
nomissbowling / Rainbow_pen.ipynb
Created December 12, 2020 06:01
Rainbow_pen.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nomissbowling
nomissbowling / curl_writefunction.c
Created January 4, 2021 04:41 — forked from kosh04/curl_writefunction.c
[cURL]コールバック関数を利用してURLの内容をバッファに溜め込む
/* $ gcc -Wall -g [-DDEBUG] curl_writefunction.c -lcurl */
/* $ ./a.out [URL] */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#define BUFFER_MAX 0x10000
size_t write_length = 0;
@nomissbowling
nomissbowling / test_libcurl.c
Last active January 4, 2021 07:21
test_libcurl.c
/*
test_libcurl.c
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe" -source-charset:utf-8 -execution-charset:utf-8 -EHsc -Fe.\test_libcurl.exe .\test_libcurl.c -I.\curl-7.74.0_2-win64-mingw\include -link /LIBPATH:.\ /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64" libcurl-x64.lib
del test_libcurl.obj
test_libcurl
------------------------------------------------------------------------
extract
from curl-7.74.0/win64/curl-7.74.0_2-win64-mingw.zip 3,565,580
to curl-7.74.0_2-win64-mingw/
#include "SDL2/SDL.h"
#include "SDL2/SDL_mixer.h"
static const char *MY_COOL_MP3 = "cool_tunes.mp3";
int main(int argc, char **argv) {
int result = 0;
int flags = MIX_INIT_MP3;
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
@nomissbowling
nomissbowling / test_pico_waveout.c
Last active January 8, 2021 06:59
test_pico_waveout.c
/*
test_pico_waveout.c
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64\cl.exe" -source-charset:utf-8 -execution-charset:utf-8 -EHsc -Fe.\test_pico_waveout.exe .\test_pico_waveout.c -I. -I.\curl-7.74.0_2-win64-mingw\include -I..\SDL2-2.0.14-dev\include -I..\SDL2_mixer-2.0.4-dev\include -link /SUBSYSTEM:CONSOLE /LIBPATH:.\ /LIBPATH:..\SDL2-2.0.14-dev\lib\x64 /LIBPATH:..\SDL2_mixer-2.0.4-dev\lib\x64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17763.0\um\x64" libcurl-x64.lib lame_enc.lib libmpg123-0.lib SDL2_mixer.lib SDL2main.lib SDL2.lib shell32.lib winmm.lib
del test_pico_waveout.obj
test_pico_waveout
------------------------------------------------------------------------
see also test_libcurl.c
------------------------------------------------------
@nomissbowling
nomissbowling / _test_pin_angle_.py
Created February 8, 2021 02:24
_test_pin_angle_.py
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
'''_test_pin_angle_
pin 8->1 line = sqrt(3)/9 = 0.19245... = tan(0.1901256...) = 10.893... (degree)
tan(10.893 deg) = 0.1924...
tan(6 deg) = 0.1051...
tan(3 deg) = 0.0524...
'''
import sys, os
@nomissbowling
nomissbowling / _test_meshgrid_contour_.py
Created February 8, 2021 05:19
_test_meshgrid_contour_.py
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
'''_test_meshgrid_contour_
'''
import sys, os
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import hsv_to_rgb