Skip to content

Instantly share code, notes, and snippets.

View butackle's full-sized avatar
🐷
happy

ぷる butackle

🐷
happy
  • Japan
View GitHub Profile
require('fs').readFile('./bio-shell/data/merge-test-c.vcf',(e,t)=>console.log(`${t}`.split('\n').map((v) => (!v ||/^#/.test(v)) ? "" : (v.split("\t")[3].length < v.split("\t")[4].length && /1\/1/.test(v.split("\t")[9])) ? v : "").filter((v)=>!!v).join("\n")))
require('fs').mkdir('./koi',() => [ ...[...Array(50)].map((v,i)=>i+1),'MT','Un'].forEach((v) => require('fs').mkdirSync(`./koi/chr${v}`)))
require('fs').readFile('/etc/passwd','utf8',(e,t) => console.log(t.split("\n").map((v) => v.replace(/:\*:.*/, "")).filter((v) =>!!v).join("\n")))
[...Array(1)].reduce(() => console.log(t([18], [24])), t = (v1, v2) => v1.some((v) => v2.some((vv) => vv === v)) ? v1.find((v) => v2.some((vv) => vv === v)) : t([...v1, v1[0]*(v1.length+1)], [...v2, v2[0]*(v2.length+1)]))
[...Array(20)].map((v,i) => [...Array(20)].slice(2).map((u, i) => i + 3).reduce((pV,num) => pV.some((pn) => !(num % pn)) ? pV : [...pV, num], [ 2 ]).some((v) => v === i +1 ) ? [...Array(20)].fill('*').map((v,ii) => ii === i ? '@' : '*').join('') : [...Array(20)].fill('*').join('')).join('\n')
require('fs').readFile('./vol.31/indent.txt','utf8',(err, text) => console.log(text.split("\n").map((v,i,a) => v[0] === "*" ? `${ a[i-1].replace(/\*.*/, "") }${ v }` : v).join("\n")))
@butackle
butackle / startup.sh
Last active October 1, 2017 06:35
startup on CentOS7
#!/bin/bash
#yum install
cd ~
sudo yum install -y wget vim
#alias
cd ~
echo "alias ll='ls -la'" >> ~/.bashrc
source ./.bashrc
@butackle
butackle / index.js
Last active September 15, 2017 04:10
20170906 express
const express = require("express");
const app = express();
//使用するポートを指定する。
const port = 8080;
const server = app.listen(port, () => {
// ポート設定時に実行される処理
console.log(`Node.js is listening to PORT: ${ server.address().port }`);
});
app.listen(2020); // 複数ポートの指定も可。
// c <= 3
// 一行
((s=0,c=3,len=900,ctx=canvas.getContext('2d'),m=([x,y,l])=>[[x,y,l],[x,y+l,l],[x+l,y+l,l],[x+l,y,l]])=>[...Array(c)].reduce((a,b,i)=>[...a,...((l=a[a.length-1][2]/3,o=[...Array(3**(i+1))].map((v,j)=>!j?l:(3*j+1)*l))=>o.reduce((c,x)=>[...c,...o.map((y)=>[x,y,l])].filter(([x,y],i)=>a.filter((v,i)=>i).map((v)=>m(v)).every((v)=>!(x>v[0][0]&&x<v[2][0]&&y>v[0][1]&&y<v[2][1]))),[])).call()],[[0,0,len],Array(3).fill(len/3)]).map((v)=>m(v)).forEach((c)=>[...c,c[0]].forEach(([x,y],i)=>new Promise((resolve)=>setTimeout(()=>resolve(i<1?ctx.moveTo(x,y):ctx.lineTo(x,y)),++s*10)).then(()=>ctx.stroke())))).call();
//複数行
(
(s = 0, c = 3, len = 900, ctx = canvas.getContext('2d'), m = ([x, y, l]) => [[x, y, l], [x, y + l, l], [x + l, y + l, l], [x + l, y, l]]) =>
[...Array(c)].reduce((a, b, i) =>
[
@butackle
butackle / 20170701_shellGei.js
Last active July 1, 2017 06:55
20170701_shellGei.js
//Q2
require("fs").readFile("./attend", (err, text) => require("fs").readFile("./attend6", (err, text6) => `${text}`.split("\n").filter((v) => !!v).forEach((v) => console.log(`${v}${text6.includes(v.split(" ")[0]) ? "出" : "欠"}`) )))
//Q4.1
console.log("-1 4 5 2 42 421 44 311 -9 -11".split(" ").sort((a,b) => Number(a) > Number(b) ? 1 : -1).map((v,i,a) => `${v} ${ !i || String(a[i+1]).length !== String(v).length ? "\n" : ""}` ).join(''))
//Q4.2
console.log("-1 +4 5 2 42 421 44 311 -9 -11".split(" ").sort((a,b) => Number(a) > Number(b) ? 1 : -1).map((v,i,a) => `${v} ${ !i || String(a[i+1]).length !== String(Number(v)).length ? "\n" : ""}` ).join(''))
//Q6