Skip to content

Instantly share code, notes, and snippets.

View kuuote's full-sized avatar
🙃
I may be slow to respond.

kuuote

🙃
I may be slow to respond.
View GitHub Profile
@kuuote
kuuote / fizzbuzz.c
Created March 19, 2018 05:42
関数ポインタを利用したFizzBuzz
#include <stdio.h>
void fizz(int num)
{
printf("%s\n", "Fizz");
}
void buzz(int num)
{
printf("%s\n", "Buzz");
@kuuote
kuuote / hello.s
Last active April 3, 2018 11:12
本物のプログラマはlibcを使わない[要出典]のでlibcレスHelloworld
#required x86-64 linux
#as -o hello.o hello.s
#ld -o hello -dynamic-linker (path to ld-linux...) hello.o
#./hello
.global hello
.global _start
.data
hello:
.string "Hello world!\n"
@kuuote
kuuote / lazyseq.cl
Created July 3, 2018 07:46
遅延シーケンステスト
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#
(progn ;;init forms
(ros:ensure-asdf)
;;#+quicklisp (ql:quickload '() :silent t)
)
@kuuote
kuuote / pi.scm
Created August 7, 2018 14:26
言語処理100本ノックの円周率のやつ
(define (split str delim)
(define (skip-delimiter s)
(if (and (pair? s) (memv (car s) delim))
(skip-delimiter (cdr s))
s))
;string -> token remainder
(define (get-token s acc)
(if (or (null? s) (memv (car s) delim))
(values (reverse acc) s)
(get-token (cdr s) (cons (car s) acc))))
@kuuote
kuuote / rainbow.vim
Last active January 29, 2020 08:34
虹色に染め上げるやつ :source して:MyRainbowで有効になります
"Wikipediaの色相環の項目の虹色
const s:colors = ['FF0000', 'FF4000', 'FF8000', 'FFBF00', 'FFFF00', 'BFFF00', '80FF00', '40FF00', '00FF00', '00FF40', '00FF80', '00FFBF', '00FFFF', '00BFFF', '0080FF', '0040FF', '0000FF', '4000FF', '8000FF', 'BF00FF', 'FF00FF', 'FF00BF', 'FF0080', 'FF0040']
const s:looper = range(1, 300)
"色付けされた行
let s:painted = 0
function! s:paintline(line) abort
for i in s:looper
function! BF(fxxk) abort
let mem = 0z00
for i in range(15)
let mem = mem + mem
endfor
let ip = 0
let dp = 0
let out = []
while ip < len(a:fxxk)
let c = a:fxxk[ip]
" ws以外の全ての関数は[result, newpos]を返す
function! s:object(in, pos) abort
let p = s:ws(a:in, a:pos + 1)
if a:in[p] == 125 " }
return [{}, p + 1]
endif
let acc = {}
while v:true
let [r, p] = s:member(a:in, p)
@kuuote
kuuote / gina-preview.vim
Created July 31, 2020 11:28
imitation of fzf-preview.vim
function! s:status() abort
let repo = finddir(".git", expand("%:p:h") .. ";")
if !empty(repo)
let repo = fnamemodify(repo, ":p")
let root = fnamemodify(repo, ":h:h") " ディレクトリ名が展開された場合末尾に/が付く
execute "tcd" root
Gina status -s
else
throw "Not a git repository."
endif
@kuuote
kuuote / templug
Created September 30, 2020 09:28
Vimのプラグインを気軽に試すやつ
#!/bin/bash -u
tmp=$(mktemp -d)
atexit() {
sudo rm -rf ${tmp}
}
trap atexit EXIT
addrepo() {
@kuuote
kuuote / gy.vim
Created October 27, 2020 16:12
yank without trailing spaces
let s:ops = {"line":"V", "char":"v", "block":"\<C-v>"}
function! DoNoSpaceYank(wise) abort
let from = getpos("'[")
let to = getpos("']")
let visualop = s:ops[a:wise]
call inputsave()
keepjumps call setpos(".", from)
keepjumps call feedkeys(visualop, "nx")