Skip to content

Instantly share code, notes, and snippets.

View y-yu's full-sized avatar

YOSHIMURA Yuu y-yu

View GitHub Profile
import random
#import pylab
import copy
G = 1.0
H = 3.5
M = 1.0
def ngp(data, n):
m = [[0] * (n+1) for i in range(n+1)]
@VienosNotes
VienosNotes / addFiles.applescript
Created October 23, 2012 04:30
add m4a files to iTunes from directory tree in AppleScript
set src to choose folder
set target_files to getFiles(src)
tell application "iTunes"
repeat with f in target_files
try
add f
delay 1
on error
log f
end try
@zr-tex8r
zr-tex8r / tcclearerr.sty
Created December 25, 2012 00:37
TeX/LaTeX : package to eliminate all compile errors at a time
\csname\if11pdfprimitive\fi\endcsname\chardef\x14\relax\pdfprimitive\catcode37\x\let%
%
% tcclearerr.sty
%
%% reset code tables
\;\relax\let\@\pdfprimitive\@\chardef\x10\;\@\catcode32\x\@\catcode13 5\;%
\endlinechar13\;\@\catcode96 12 \@\catcode61 12\;%
\ifx\@@par\tcce@undefined \@\par \else \@@par \fi% switch to vmode
\@\catcode`\{=1 \@\catcode`\}=2 \@\catcode`\@=11
\@\catcode`\#=6 \@\catcode`\~=13 \@\catcode`\<=12
@zr-tex8r
zr-tex8r / taple.tex
Last active December 10, 2015 19:39 — forked from y-yu/taple.tex
\documentclass{jarticle}
\makeatletter
% registers are ALWAYS allocated globally (darn!)
\newcount\@fuck@i
\newcount\@fuck@ii
\def\tuple#1{%
\begingroup
@okapies
okapies / promises-are-functional.md
Last active August 14, 2023 11:44
翻訳: ”命令型のコールバック、関数型のプロミス: Node が逸した最大の機会” by James Coglan

命令型のコールバック、関数型のプロミス: Node が逸した最大の機会

Original: "Callbacks are imperative, promises are functional: Node's biggest missed opportunity" by James Coglan

Translated by Yuta Okamoto (@okapies)

Note

  • 訳者は JavaScript や Node.js に関する専門知識がほとんどありません。識者のツッコミをお待ちしております。「◯◯が分からない」等も歓迎です。
  • 元記事から構成を一部変更しています。また、関数型プログラミングに関する記述のうち、議論の骨子に絡まないものは省略しています。
@Mortimerp9
Mortimerp9 / readerwithtooling.scala
Created April 14, 2013 22:14
An implementation of the Reader Monad in scala, with correct type variance and some implicit utils to simplify the daily use of Readers, In particular with Future.
/**
* A monad to abstract dependencies in the code, see https://coderwall.com/p/kh_z5g
*/
object Reader {
/**
* an implicit to convert a function A => B in a Reader[A, B]
*/
implicit def reader[C, R](block: C => R): Reader[C, R] = Reader(block)
@pthariensflame
pthariensflame / IndexedCont.md
Last active April 3, 2022 00:30
An introduction to the indexed continuation monad in Haskell, Scala, and C#.

The Indexed Continuation Monad in Haskell, Scala, and C#

The indexed state monad is not the only indexed monad out there; it's not even the only useful one. In this tutorial, we will explore another indexed monad, this time one that encapsulates the full power of delimited continuations: the indexed continuation monad.

Motivation

The relationship between the indexed and regular state monads holds true as well for the indexed and regular continuation monads, but while the indexed state monad allows us to keep a state while changing its type in a type-safe way, the indexed continuation monad allows us to manipulate delimited continuations while the return type of the continuation block changes arbitrarily. This, unlike the regular continuation monad, allows us the full power of delimited continuations in a dynamic language like Scheme while still remaining completely statically typed.

@y-yu
y-yu / zip.md
Last active December 29, 2015 07:39
zip

zip関数

次のような機能を満す関数zipを作ってほしい。ただし次のような制約がある。

  • C++11
  • STLはOK
  • BoostはNG

大嘘

@tyage
tyage / web400.js
Last active January 4, 2016 13:29
seccon quals seccon競馬 writeup
var socket = io.connect('http://133.242.52.129');
for(p in socket_routes){
socket.on(p, (function(p) {
return function(message){
console.log(message.data && 'waku:' + message.data.id, message.data && 'rank:' + message.data.seq)
};
})(p));
}