Skip to content

Instantly share code, notes, and snippets.

@takeisa
takeisa / .cursorrules
Created June 1, 2025 00:09 — forked from boxabirds/.cursorrules
Rock solid: turn Cursor into a rock-solid software engineering companion
# Project Policy
This policy provides a single, authoritative, and machine-readable source of truth for AI coding agents and humans, ensuring that all work is governed by clear, unambiguous rules and workflows. It aims to eliminate ambiguity, reduce supervision needs, and facilitate automation while maintaining accountability and compliance with best practices.
# 1. Introduction
> Rationale: Sets the context, actors, and compliance requirements for the policy, ensuring all participants understand their roles and responsibilities.
## 1.1 Actors
@takeisa
takeisa / sum.c
Last active September 10, 2022 09:14
Example using GCC's inline assembler. Compute the sum of 1 to 10. GCCのインラインアセンブラを使った例。1から10までの総和を計算する。
#include <stdio.h>
// Example using GCC's inline assembler.
// Compute the sum of 1 to 10.
// GCCのインラインアセンブラを使った例。
// 1から10までの総和を計算する。
// use compiler option -masm=intel
@takeisa
takeisa / gist:c00f6d2e9250bc05df81
Last active August 29, 2015 14:05
OCaml ulex and menhir make file
===Makefile===
default: native
native:
ocamlbuild -use-ocamlfind -yaccflags --explain main.native
clean:
ocamlbuild -clean
%token VAL1 EOF
%start <int option> prog
%%
prog:
| VAL1 { Some 1}
| EOF { None }
;
import Data.List(sortBy)
myLength :: [a] -> Int
myLength [] = 0
-- myLength (x:xs) = 1 + myLength xs
myLength (_:xs) = 1 + myLength xs
-- sumList :: [Double] -> Double
-- sumList [] = 0
@takeisa
takeisa / gist:3806817
Created September 30, 2012 14:03
[Clojure] prime? (memoize sample)
(defn prime? [n]
(cond
(== n 1) false
(== n 2) true
(even? n) false
:else (->> (range 3 (inc (Math/sqrt n)) 2)
(every? #(pos? (rem n %))))))
(def m-prime? (memoize prime?))
@takeisa
takeisa / gist:3806625
Created September 30, 2012 12:24
[Clojure] Twitter access sample
(require '[clojure.xml :as xml])
(defn twitter-followers [user-name]
(->> (str "https://api.twitter.com/1/users/show.xml?screen_name=" user-name)
xml/parse
:content
(filter (comp #{:followers_count} :tag))
first
:content
first
@takeisa
takeisa / gist:3806325
Created September 30, 2012 09:26
[Clojure] Logger example
;; Clojure logger example
(defn print-logger [writer]
#(binding [*out* writer]
(println %)))
(def *out*-logger (print-logger *out*))
(def writer (java.io.StringWriter.))
@takeisa
takeisa / gist:3769042
Created September 23, 2012 06:03
Common Lisp format memo
* common-lisp: format:
~a aesthetic
~s readで読める形式
~:a nil → () で出力
~% 改行
~& 先頭でないときに改行
~5% 5個改行
~~ ~を出力
~5~ 5個出力
~c 文字