Skip to content

Instantly share code, notes, and snippets.

View terasakisatoshi's full-sized avatar

Satoshi Terasaki terasakisatoshi

View GitHub Profile
@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
)
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",
@Juanvulcano
Juanvulcano / imagenet_label_to_wordnet_synset.json
Last active June 10, 2021 21:30
ImageNet labels to wordnet synset identifier. JSON file parsed from: https://gist.github.com/fnielsen/4a5c94eaa6dcdf29b7a62d886f540372 . Can be used to organize Imagenet synsets to Wordnet's identifiers
{
"0": {
"id": "01440764-n",
"label": "tench, Tinca tinca",
"uri": "http://wordnet-rdf.princeton.edu/wn30/01440764-n"
},
"1": {
"id": "01443537-n",
"label": "goldfish, Carassius auratus",
"uri": "http://wordnet-rdf.princeton.edu/wn30/01443537-n"
@aviatesk
aviatesk / collectgen.jl
Last active May 4, 2020 12:21
`@collect` and `@generator` macro -- might be useful in competitive programming, etc...
using MacroTools
function decompose_forblk(forblk)
spec, body = forblk.args
i, itr = spec.args
return i, itr, body
end
"""