Skip to content

Instantly share code, notes, and snippets.

View kawakami-o3's full-sized avatar

Hayato Mikami kawakami-o3

View GitHub Profile
@kawakami-o3
kawakami-o3 / main.lisp
Created November 25, 2018 13:37
macro exercise
;; incf
(defmacro inc! (p)
`(setf ,p (+ ,p 1)))
@kawakami-o3
kawakami-o3 / readme.md
Created September 30, 2018 17:46
Go落穂拾い
godoc -http ":8888" -analysis type
@kawakami-o3
kawakami-o3 / my.cnf
Created September 28, 2018 08:24
MySQL8 'LOAD DATA LOCAL' Issue
[client]
loose-local-infile=1
[mysqld]
local_infile=1
sudo pacman-key --populate archlinux
sudo pacman -Syu
sudo pacman -S \
fish gauche sbcl rlwrap vim emacs ruby wget git curl hub \
gcc llvm clang make cmake fakeroot
git clone https://aur.archlinux.org/yay.git
@kawakami-o3
kawakami-o3 / class.lisp
Last active September 10, 2018 15:58
field
(defmacro field (slot-symbol)
(let ((slot-name (symbol-name slot-symbol)))
`(,slot-symbol
:accessor ,(intern slot-name)
:initform '()
:initarg ,(intern slot-name :keyword))))
;; not working
(defclass player ()
((field hp)
@kawakami-o3
kawakami-o3 / init.el
Last active September 8, 2018 08:07
init.el
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
(setq-default indent-tabs-mode t)
(setq default-tab-width 2)
(define-key global-map "\C-h" 'delete-backward-char)
(define-key key-translation-map (kbd "C-h") (kbd "<DEL>"))
@kawakami-o3
kawakami-o3 / eval_0.lisp
Last active July 15, 2018 16:08
broken compilation from lisp to c
(progn
(define _eval
(lambda (form env)
(+ 1 1)))
(define *env* (quote (nil nil)))
(define _assoc
(lambda (item lis)
@kawakami-o3
kawakami-o3 / test.c
Created July 8, 2018 07:23
car, cons, add
#include<stdio.h>
#include<stdlib.h>
#define new(a) malloc(sizeof(a))
typedef struct {
int i;
} Atom;
Atom *make_atom(int i) {
/* test.lisp
(define a 1)
(define b 10)
(print a)
(print b)
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
@kawakami-o3
kawakami-o3 / detectLineBreak.go
Last active May 10, 2018 12:47
Detect line break, new line (CR, LF, CRLF)
const (
lineUnknown = "unkown"
lineLF = "LF" // 0x0A
lineCR = "CR" // 0x0D
lineCRLF = lineLF + lineCR
)
const (
byteLF = 0x0A
byteCR = 0x0D