Skip to content

Instantly share code, notes, and snippets.

View kaz-yos's full-sized avatar
💭
I may be slow to respond.

Kazuki Yoshida kaz-yos

💭
I may be slow to respond.
View GitHub Profile
@kaz-yos
kaz-yos / foldx.lisp
Last active August 29, 2015 14:19 — forked from ha2ne2/foldx.lisp
(defun foldr (f lst)
(if (null (cdr lst)) (car lst)
(funcall f (car lst) (foldr f (cdr lst)))))
(defun foldl (f lst)
(if (null (cdr lst)) (car lst)
(funcall f (foldl f (butlast lst)) (car (last lst)))))
(defun foldr-tail (f a lst)
(if (null lst) a
;;; my naive solution to clojure puzzle at
;;; Boston Clojure meetup on 8/14/2015
;;; http://www.meetup.com/Boston-Clojure-Group/events/224014745/?a=uc1_te&_af=event&_af_eid=224014745
(def bosclj-data
[[:b 7 2 1 2 2 2 1 2 1 2 7]
[:b 1 5 1 3 3 1 3 2 2 1 1 5 1]
[:b 1 1 3 1 1 1 3 1 3 1 1 3 1 1 1 1 3 1 1]
[:b 1 1 3 1 1 2 3 1 3 2 2 2 1 1 3 1 1]
[:b 1 1 3 1 1 3 1 3 1 2 3 2 1 1 3 1 1]
[:b 1 5 1 2 1 3 1 3 1 1 1 2 1 5 1]
@kaz-yos
kaz-yos / file0.txt
Created December 5, 2015 12:24
init.el: MacのキーボードでMetaAltSuperHyper ref: http://qiita.com/kaz-yos/items/4cdb603fc8b54ee1ff73
;;; Mac-only configuration to use command and options keys
(when (eq system-type 'darwin)
;; Mac-only
;; Command key as Meta key, Option key untouched
;; http://www.emacswiki.org/emacs/MetaKeyProblems#toc15
;; http://ergoemacs.org/emacs/emacs_hyper_super_keys.html
;;
;; left command
(setq mac-command-modifier 'meta)
;; left option
## オリジナル
result<-NULL
for(i in 1:20000){
result<-c(result,roc(...))
}
## 2000-vectorを最初に作成
result <- as.numeric(rep(NA,2*10^4))
for(i in 1:20000){
result[i] <- roc(...)
@kaz-yos
kaz-yos / elecrow_config.txt
Last active December 10, 2024 03:27
Elecrow 5inch 800x480 LCD configuration for Raspberry Pi (Add to the bottom of /boot/config.txt)
### Elecrow HDMI 5inch 800x480 LCD display
# https://www.amazon.com/Elecrow-Display-Monitor-800x480-Raspberry/dp/B013JECYF2/
# Adopted from the following URL. Modified for clarity and corrections.
# https://www.amazon.com/gp/aw/review/B013JECYF2/R3ZXW0VTV8AEB/ref=cm_cr_dp_mb_rvw_1?ie=UTF8&cursor=1
# DOCUMENTATION > CONFIGURATION > CONFIG-TXT
# https://www.raspberrypi.org/documentation/configuration/config-txt.md
### Display configuration
# hdmi_group: 0 auto-detect from EDID; 1 CEA; 2 DMT
hdmi_group=2
@kaz-yos
kaz-yos / .emacs
Last active January 13, 2021 23:26
.emacs file to run Spacemacs and regular Emacs side by side.
;;; dot_emacs.el --- -*- lexical-binding: t; -*-
;;; Select emacs config file directory depending on emacs being run
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
;; (package-initialize)
;;; Suppress messages
;; http://qiita.com/itiut@github/items/d917eafd6ab255629346
;; http://emacs.stackexchange.com/questions/14706/suppress-message-in-minibuffer-when-a-buffer-is-saved
(defmacro with-suppressed-message (&rest body)
"Suppress new messages temporarily in the echo area and the `*Messages*' buffer while BODY is evaluated."
(declare (indent 0))
(let ((message-log-max nil))
`(with-temp-message (or (current-message) "") ,@body)))
;;;
@kaz-yos
kaz-yos / detect-org-babel-languages.el
Created January 30, 2017 02:43
Detect all languages used in org-babel src blocks in a file.
(defun org-babel-get-all-src-block-info ()
"Get information on all src blocks in an org file."
(interactive)
(let ((lst '()))
(save-excursion
;; Go to the beginning of buffer
(beginning-of-buffer)
(while (condition-case err
;; Try to move to the next src block.
(org-next-block nil nil org-babel-src-block-regexp)
@kaz-yos
kaz-yos / AlternativeMIcombine.R
Created February 10, 2017 23:49
Alternative version of mitools:::MIcombine.default
## Implement multivariate version of Rubin's formula
## eq 14 in https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4029775/
## Page 97 of https://www.amazon.com/Multiple-Imputation-Nonresponse-Surveys-Donald/dp/0471655740
AlternativeMIcombine.default <- function (results, variances, call = sys.call(), df.complete = Inf, ...) {
m <- length(results)
oldcall <- attr(results, "call")
if (missing(variances)) {
variances <- suppressWarnings(lapply(results, vcov))
results <- lapply(results, coef)
}
@kaz-yos
kaz-yos / jpeg.rb
Last active August 7, 2017 13:37
Homebrew Formula for libjpeg version 8d (9b broke my emacs)
class Jpeg < Formula
desc "Image manipulation library"
homepage "http://www.ijg.org"
url "http://www.ijg.org/files/jpegsrc.v8d.tar.gz"
sha256 "00029b1473f0f0ea72fbca3230e8cb25797fbb27e58ae2e46bb8bf5a806fe0b3"
bottle do
cellar :any
rebuild 2
sha256 "85d1f6055de99c1b764c697498bb86d003f5d24b324133f036f0393b97b3e869" => :sierra