Skip to content

Instantly share code, notes, and snippets.

:- use_module(library(clpfd)).
piece(_, []).
piece([_ | Frame], [[] | Piece]) :-
piece(Frame, Piece).
piece([[X | FrameLine] | Frame], [[X | PieceLine] | Piece]) :-
piece([FrameLine | Frame], [PieceLine | Piece]).
tail([], []).
tail([_ | T], T).
@otaon
otaon / 000_how-to-construct-environment-for-common-lisp.md
Last active July 23, 2022 08:52
vim と slimv と roswell と swank で common lisp を書く環境を作る

本記事の位置づけ

下記を実現するための手順書。

  • roswell(lisp実行環境構築ツール)を導入する
  • slimv(VimにおけるSLIME)を導入する
  • roswellとslimvでcommon lispをコーディング、実行するための設定をする

手順一覧

下記の順番に環境構築する。

@qnighy
qnighy / pi.v
Last active October 17, 2017 15:57
Pi-calculus defs in Coq
Require Import List.
(* A name defines a pair of channels.
* We need countably many names, so we use nat.
*
* Denoted as "a", "b", "c", ...
*)
Definition Name := nat.
(* A pair of channels looks like FIFO.

共変・反変があるとどう嬉しいのか考えるコーナー

考える際の土台として、以下のようなクラスを考えます。

class Person(val name: String)
class Teacher(override val name: String, val kamoku: String) extends Person(name)

また 文字列からクラスAのインスタンスを生成する Read[A] とクラスAのインスタンスから文字列を生成する Write[A] というクラスについて考えてみます。(ReadはfromJson、WriteはtoJsonのようなイメージです。)

@penguin2716
penguin2716 / auto_wget_img.rb
Last active January 4, 2016 10:58
まとめサイトとかから自動で画像をwgetしてくれるRubyスクリプト
#!/usr/bin/env ruby
#-*- coding: utf-8 -*-
=begin
Auto wget image
Copyright (c) 2014 Takuma Nakajima
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
@aomoriringo
aomoriringo / gist:7706985
Last active October 19, 2021 21:59
任意画像の輪郭を数式に変換してプロットする (Mathematica ver.8)
(* parameters *)
(* 最大次数 *)
maxOrderNum = 200;
(* 画像URL, もしくはローカルパス *)
imageURL = "http://nex.fm/wp-content/uploads/2012/08/vim-editor_logo.png";
pointListToLines[pointList_, neighbothoodSize_: 6] :=
Module[{L = DeleteDuplicates[pointList], NF, lambda,
lineBag, counter, seenQ, sLB, nearest,
nearest1, nextPoint, couldReverseQ, d, n, s},
@alexjs
alexjs / cors-nginx.conf
Created November 28, 2012 22:42 — forked from michiel/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
@hayajo
hayajo / changelog_en.md
Last active May 3, 2024 08:29
ChangeLog を支える英語

ChangeLog を支える英語

ChangeLog を書く際によく使われる英語をまとめました。

ほとんど引用です。

基本形

@rosylilly
rosylilly / gist:3401612
Created August 20, 2012 06:40
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。