数学力爆炸(大雾)
data = [...]
var chart_height = 200
var bar_width = 30
var bar_gap = 10
var svg = d3.select("svg")
svg.append("defs").append("style").text(`
rect
{
fill: #6495ed;
}
rect:hover
{
fill: #000;
}
`)
svg.selectAll("rect")
.data(data)
.append("rect")
.attr("x", (d, i)=> i * (bar_width + bar_gap) )
.attr("y", (d)=>chart_height - d )
.attr("width", bar_width)
.attr("height", (d)=>d)
int pstdin [2];
int pstdout[2];
pipe(pstdin);
pipe(pstdout);
switch (child = vfork())
{
case -1: // error
perror("fork failed");
exit(EXIT_FAILURE);
break;
case 0: // child
dup2(pstdin [0], 0);
dup2(pstdout[1], 1);
close(pstdin [1]);
close(pstdout[0]);
execlp("pinentry", "pinentry");
perror("execlp just return");
exit(EXIT_FAILURE);
break;
default: // parent
close(pstdin [0]);
close(pstdout[1]);
break;
}
write(pstdin[1], "input\n", 6);
read(pstdout[0], buff, len);
waitpid(child, NULL, 0);
close(pstdin [1]);
close(pstdout[0]);
莉特雅 literal
写代码业余爱好者 amateur coder