$ bash --version
GNU bash, version 4.3.46(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
mkfifo /tmp/p{1..4} 2>/dev/null; sleep 1; while true; do echo ハゲ; sleep 1 ;done | tee /tmp/p1 | |
stdbuf -oL cat /tmp/p1 | stdbuf -oL sed -n = | tee /tmp/p2 | |
stdbuf -oL cat /tmp/p2 | stdbuf -oL factor | stdbuf -oL tee /tmp/p3 | |
stdbuf -oL cat /tmp/p3 | while read n; do echo $n | awk 'NF==2{print $2;}'; done | |
``` | |
cat cmd | xpanes -e | |
cure precures | cure tr '[:precure_name:]' '[:girl_name:]' | nl | awk '{print "sleep "$1"; cure echo -p "$2" | say -v Kyoko"}' | xpanes -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yes 山田エルフ \ | |
| head -n 5 \ | |
| awk -vFS= -vOFS=" " 'NR==1{system("echo "$0"|rev|tr -d \\\\n");print $2$3$4$5};NR<6{s=$(NR+1);for(i=0;i<4-NR;i++)printf OFS;printf s;for(i=1;i<NR;i++)printf OFS;printf s;for(i=1;i<NR;i++)printf OFS;print s;}' | |
# -- Result | |
# フルエ田山田エルフ | |
# 田田田 | |
# エ エ エ | |
# ル ル ル | |
# フ フ フ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q () | |
{ | |
type Q | sed '1d;$aQ' | |
} | |
Q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 【話題の一行問題】東大数学2015第5問【2015Cmが偶数】をEgisonで解く | |
; https://www.youtube.com/watch?v=MfrT_QGCkRo | |
(define $main | |
(lambda [$argv] | |
(each display | |
(match | |
(map 1#(2#[%1 %2 (modulo %2 2)] %1 (comb 2015 %1)) | |
(take 2015 nats)) | |
(list [integer integer integer]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
class Test { | |
public static void main(String args[]) { | |
int num = 100; | |
Map<Integer, Boolean> list = new HashMap<Integer, Boolean>(); | |
for (int i = 2; i <= num; i++) { | |
list.put(i, true); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Clipboard integration by Operating System Controls from Vim | |
" Usage: | |
" Yank something and run :OscCopy | |
" or | |
" Copy range in visual mode and run :'<,'>OscCopyRange | |
" From: https://stackoverflow.com/questions/1533565/how-to-get-visually-selected-text-in-vimscript | |
function! GetVisualSelection() | |
let [lnum1, col1] = getpos("'<")[1:2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-${(%):-%N}}")"; pwd)" | |
files=("$(find ${THIS_DIR-}/lib -type f)") | |
class_lines=("$(printf '%s\n' "${files[@]}" \ | |
| xargs -n 1 grep -m 1 -E '^(abstract )?class' \ | |
| sed -r 's/^.*class ([A-Za-z]+)/\1/')") | |
class_names=("$(printf '%s\n' "${class_lines[@]}" | awk '{print $1}')") | |
remove_buildin_classes () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env egison | |
(define $main | |
(lambda [$args] | |
(each display | |
(farray-same2 farray)))) | |
(define $farray | |
(filter 1#(eq? (length %1) 3) | |
(map (p-f $) (take 100 nats)))) |