Skip to content

Instantly share code, notes, and snippets.

View terasakisatoshi's full-sized avatar

Satoshi Terasaki terasakisatoshi

View GitHub Profile
@tokugh
tokugh / index(auto).md
Last active October 2, 2024 07:31
Ollama API wrapper module for Julia

ollama_api モジュールドキュメンテーション

注意:このドキュメンテーションは生成AIによる自動生成です。 MacBookPro 13-inch, M1, 2020でのみ動作を確認しています。

概要

ollama_apiは、Julia用のOllama APIラッパーモジュールです。このモジュールは、Ollama APIとの通信を簡素化し、テキスト生成や会話型AIの機能を提供します。

主要な機能

@dc1394
dc1394 / mc_xorshift.cpp
Created December 31, 2023 13:17
Twitterのモンテカルロ法のC++版の速度比較コード(Xoshiro256PlusSIMD使用)
#include <iomanip> // for std::setprecision
#include <ios> // for std::ios::fixed, std::ios::floatfield
#include <iostream> // for std::cout, std::endl
#include <utility> // for std::make_pair, std::pair
#define __AVX2_AVAILABLE__
#include "SIMDInstructionSet.h"
#include "Xoshiro256Plus.h"
namespace {
inline double mcpi();
@dc1394
dc1394 / mc_mt19937.cpp
Created December 31, 2023 13:13
Twitterのモンテカルロ法のC++版の速度比較コード(C++のmt19937)
#include <iomanip> // for std::setprecision
#include <ios> // for std::ios::fixed, std::ios::floatfield
#include <iostream> // for std::cout, std::endl
#include <random> // for std::mt19937, std::uniform_real_distribution
namespace {
inline double mcpi();
}
int main()
@gh640
gh640 / asyncio_streaming_example.py
Created December 12, 2021 02:45
Python: Stream output of `asyncio.create_subprocess_exec()`
"""Stream output of `asyncio.create_subprocess_exec()`"""
import asyncio
import sys
async def run(program: str, args: list[str]):
"""Capture output (stdout and stderr) while running external command."""
proc = await asyncio.create_subprocess_exec(
program, *args, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)
@terasakisatoshi
terasakisatoshi / channel.jl
Created October 31, 2021 07:41
Channels in Action
using Random
using ProgressMeter
function myproducer(ch::Channel, seed)
Random.seed!(seed)
while true
r = rand()
if r > 0.5
put!(ch, r)
else
S = "\t☆
    /\
   /★∴ \
  (人_人_人)
  /∴∵★∵★∵ \
  (_人_人_人_)
  /☆∴∵∴∵★ ∴ \
 (_人★人☆人_ )
    ̄凵 ̄ "
@Loliver1224
Loliver1224 / Julialang.sty
Last active November 5, 2020 06:27
Julia-lang style definition for LaTeX Listings.
%% Julia definition (c) 2020 Daichi Furukawa
%%
\lstdefinelanguage{Julia}{%
morekeywords={abstract, ans, baremodule, begin, break, const, continue, do,%
elseif, else, end, export, finally, for, function, global, if, import,%
let, local, macro, module, mutable, primitive, quote, return, struct, try,%
type, using, var, where, while},%
% Types
morekeywords=[2]{Any, Array, Bool, BigInt, BigFloat, Char, DataType, Enum,%
Expr, Float16, Float32, Float64, Function, Inf, Inf16, Inf32, Int8, Int16,%
@rpkyle
rpkyle / app.jl
Last active October 31, 2021 04:05
Dash for Julia Stock Ticker Sample App
using Dash, DashHtmlComponents, DashCoreComponents, HTTP, CSV, Dates, Printf
r = HTTP.request("GET", "https://finance.yahoo.com/quote/AMZN/history?p=AMZN");
crumb = match(r"(?:CrumbStore\"\:\{\"crumb\":\")(.*?)(?:\")", String(r.body)).captures;
session_cookie = match(r"(?:B=)(.*?)(?:;)", HTTP.header(r, "Set-Cookie")).captures;
app = dash();
app.layout = html_div(style=Dict("width"=>"500")) do
dcc_dropdown(
using AbstractPlotting
using AbstractPlotting.MakieLayout
using GLMakie; GLMakie.activate!()
GLMakie.GLFW.WindowHint(GLMakie.GLFW.FLOATING, 1)
using LinearAlgebra
##
scene = Scene(center = false, raw = true, resolution = (800, 800))
@h3y6e
h3y6e / getting-started-with-latex.md
Last active January 10, 2024 10:14
Dockerを用いてVSCodeにLaTeX環境を作成する
  1. paperist/alpine-texlive-ja をpull
$ docker pull paperist/alpine-texlive-ja
  1. setting.jsonに以下を追記
    "latex-workshop.latex.tools": [
        {
          "name": "ptex2pdf",
 "command": "docker",