Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am risou on github.
  • I am risou (https://keybase.io/risou) on keybase.
  • I have a public key ASAKDUsZS4Xm6Tld8ewkRZ0pQivYyvzE8GAJq10FkV9crQo

To claim this, I am signing this object:

@risou
risou / github_api_rate_limit.js
Created April 16, 2018 08:43
GitHub の organization ごとの assigned issue の件数を Slack の custom status に設定するやつ
/*
GitHub の API の rate limit まで何回リクエスト可能回数が残っているかを取得
*/
const request = require('request')
const token = ''
const options = {
url: 'https://api.github.com/rate_limit',
json: true,
@risou
risou / test.t
Created December 8, 2016 08:45
List::Compare を使ったリストの差分抽出……なんでこんなに速いんだろう?
use strict;
use warnings;
use t::Utils;
use Test::More;
use List::MoreUtils qw/natatime/;
use List::Compare;
use Math::Random::MT;
use Time::Seconds;
use Time::HiRes qw/gettimeofday tv_interval/;
@risou
risou / private.xml
Last active October 19, 2016 11:56
Karabiner の設定ファイル
<?xml version="1.0"?>
<root>
<list>
<item>
<name>AquaSKK</name>
<appdef>
<appname>Terminal</appname>
<equal>com.googlecode.iterm2</equal>
<equal>com.apple.Terminal</equal>
</appdef>
@risou
risou / haskell_90.hs
Created January 1, 2014 10:05
99 questions No.90
generate :: Int -> [[Int]]
generate 0 = [[]]
generate n = iter [1..n] [] where
iter [] ys = return (reverse ys)
iter xs ys = do
x <- xs
iter (filter (/=x) xs) (x:ys)
queens :: Int -> [[Int]]
queens n = filter test $ generate n
#!/usr/bin/env perl6
my $max = 0;
for (1..1000) -> $x {
for (1..1000) -> $y {
$max = 0;
for (1..1000) {
my @a;
my $n = (($x-1)*1000+($y-1))*1000+$_;
@risou
risou / encapsuled.java
Created October 11, 2011 11:45
カプセル化例
class TwoDimensionsPoint {
private double x;
private double y;
public void setX(double x) {
this.x = x;
}
public double getX() {
return this.x;
}
Definition prop0 : forall (A : Prop), A -> A.
Proof.
intros.
apply H.
Qed.
Goal forall (P Q : Prop), (forall P : Prop, (P -> Q) -> Q) -> ((P -> Q) -> P) -> P.
Proof.
intro.
intro.
@risou
risou / calc4num
Created April 20, 2011 11:11
calc 4 numbers for these sum and diff.
public static void main(String[] args) {
System.out.println("start");
for (int i=13;i<100;i++) {
for (int j=12;j<i;j++) {
for (int k=11;k<j;k++) {
for (int l=10;l<k;l++) {
int[] n = new int[]{i+j, i+k, i+l, j+k, j+l, k+l, k-l, j-l, j-k, i-l, i-k, i-j};
Arrays.sort(n);
Definition plus (n : nat)(m : nat) : nat := n + m.
Definition id (A : Type)(x : A) : A := x.
Definition prop0 : forall (A : Prop), A -> A := fun A x => x.
Definition prop1 : forall (A B C : Prop), (B -> C) -> (A -> B) -> (A -> C) := fun A B C f g x => f (g x).
Definition q0 : forall (A B : Prop), A -> (A -> B) -> B := fun A B f g => g (f).