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
;;; 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 / .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)
@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
## オリジナル
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 / 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
;;; 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 / 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
@kaz-yos
kaz-yos / pi.clj
Created March 13, 2015 17:09
Pi Day
;;; pi calculation in Clojure
(defn square
"Square a number"
[n]
(* n n))
(defn seq-of-numerators
"Sequence of numerators up to n-th element"
[n]
#!/usr/bin/env lein-exec
;; Can run as a shell script if proper configurations have been done
;; https://github.com/kumarshantanu/lein-exec#executable-scripts
;;; Getting dependencies from within script
;; https://github.com/kumarshantanu/lein-exec#getting-dependencies-from-within-script
;; Usually run by lein exec script.clj
(use '[leiningen.exec :only (deps)])
(deps '[[org.clojure/clojure "1.6.0"]
[bigml/sampling "3.0"]])
#_(defdeps ;; Need to be at line 1
[[org.clojure/clojure "1.6.0"]
[bigml/sampling "3.0"]])
;; lein oneoff script.clj to run
;; https://github.com/mtyaka/lein-oneoff
;; Namespace
(ns oneoff
(:require [clojure.string :as cstr]
[clojure.set :as cset]