让它看起来像我在工作


278

通常,我发现自己正在运行需要花费大量时间才能运行的脚本或查询。我可以将该脚本保持打开状态,并享受一些无罪的拖延。

现在,如果我可以编写一个脚本,对于任何旁观者来说,上述脚本似乎都是上述脚本之一,但仅在外观上如何?我可以把它放到屏幕上,享受几天小猫直播,然后再有人意识到,屏幕上所有复杂的琐事都与我的实际工作无关。

您的挑战是为我编写此脚本(是的,我很懒)。

一个好的答案将是:

  • 使某些内容出现在屏幕上,好像脚本正在工作。“屏幕”可以是终端,浏览器等。
  • 相当新颖(是的,我们都看过永无止境的进度条程序)
  • 进行技术人员的粗略检查

一个错误的答案将是:

  • 让我被解雇
  • 重新整理90年代我们都转发过的东西

一个出色的答案可能是:

  • 超越上面的错误要点之一(例如
  • 生存关键检查
  • * gasp *实际上可以一些有用的事情或有助于我的工作

验收将基于票数,实际结果会带来加分。当我的屏幕(会议等)可见时,我实际上将在工作时运行这些脚本(Linux Mint 16)以确定检测。如果有人注意到它在伪造,那您就没钱了。如果有人评论我的努力程度,则+5奖金将为您投票。

在这种情况下,“有用”可以适用于任何编码器,但是如果您希望在老师绑定的苹果上获得更多的光彩,那么我是一个全栈的Webdev,他会根据我的标签大致上在代码中工作。

问题部分受到启发。

结果

令人失望的是,我在这些条目上都没有收到任何评论。他们都很棒,所以你们都是我心中的赢家。但是,Loktar在远距离获得最多的选票,因此他从接受中获得+15的选票。恭喜!


6
人气竞赛的获奖标准是什么?
Kyle Kanos 2014年

36
那么...如果您测试答案却确实被解雇了怎么办?
鲍勃

54
这给了我另一个高尔夫球问题代码的想法。“让我看起来好像不应该搁置我的问题”
twiz 2014年

9
只需编写这些程序之一,然后编译
ugoren 2014年

13
前几天,我在Github上看到了Tron Legacy会议室的翻版,非常好:github.com/arscan/encom-boardroom
Paul Prestidge 2014年

Answers:


291

的JavaScript

所以我对此有些疯狂。在使用GUI跟踪使用Visual Basic的IP的过程中,我做了两次休息。

您也可以通过访问我今晚为此做的超级认真的领域来访问它,以便您可以在Gui Hacker和fork的任何地方忙碌起来,并通过以下来源创建自己的网站

基本上,如果您执行此操作,则不会有人打扰您,因为他们知道您正在做一些严肃的事情。

var canvas = document.querySelector(".hacker-3d-shiz"),
  ctx = canvas.getContext("2d"),
  canvasBars = document.querySelector(".bars-and-stuff"),
  ctxBars = canvasBars.getContext("2d"),
  outputConsole = document.querySelector(".output-console");

canvas.width = (window.innerWidth / 3) * 2;
canvas.height = window.innerHeight / 3;

canvasBars.width = window.innerWidth / 3;
canvasBars.height = canvas.height;

outputConsole.style.height = (window.innerHeight / 3) * 2 + 'px';
outputConsole.style.top = window.innerHeight / 3 + 'px'


/* Graphics stuff */
function Square(z) {
  this.width = canvas.width / 2;
  this.height = canvas.height;
  z = z || 0;

  this.points = [
    new Point({
      x: (canvas.width / 2) - this.width,
      y: (canvas.height / 2) - this.height,
      z: z
    }),
    new Point({
      x: (canvas.width / 2) + this.width,
      y: (canvas.height / 2) - this.height,
      z: z
    }),
    new Point({
      x: (canvas.width / 2) + this.width,
      y: (canvas.height / 2) + this.height,
      z: z
    }),
    new Point({
      x: (canvas.width / 2) - this.width,
      y: (canvas.height / 2) + this.height,
      z: z
    })
  ];
  this.dist = 0;
}

Square.prototype.update = function() {
  for (var p = 0; p < this.points.length; p++) {
    this.points[p].rotateZ(0.001);
    this.points[p].z -= 3;
    if (this.points[p].z < -300) {
      this.points[p].z = 2700;
    }
    this.points[p].map2D();
  }
}

Square.prototype.render = function() {
  ctx.beginPath();
  ctx.moveTo(this.points[0].xPos, this.points[0].yPos);
  for (var p = 1; p < this.points.length; p++) {
    if (this.points[p].z > -(focal - 50)) {
      ctx.lineTo(this.points[p].xPos, this.points[p].yPos);
    }
  }

  ctx.closePath();
  ctx.stroke();

  this.dist = this.points[this.points.length - 1].z;

};

function Point(pos) {
  this.x = pos.x - canvas.width / 2 || 0;
  this.y = pos.y - canvas.height / 2 || 0;
  this.z = pos.z || 0;

  this.cX = 0;
  this.cY = 0;
  this.cZ = 0;

  this.xPos = 0;
  this.yPos = 0;
  this.map2D();
}

Point.prototype.rotateZ = function(angleZ) {
  var cosZ = Math.cos(angleZ),
    sinZ = Math.sin(angleZ),
    x1 = this.x * cosZ - this.y * sinZ,
    y1 = this.y * cosZ + this.x * sinZ;

  this.x = x1;
  this.y = y1;
}

Point.prototype.map2D = function() {
  var scaleX = focal / (focal + this.z + this.cZ),
    scaleY = focal / (focal + this.z + this.cZ);

  this.xPos = vpx + (this.cX + this.x) * scaleX;
  this.yPos = vpy + (this.cY + this.y) * scaleY;
};

// Init graphics stuff
var squares = [],
  focal = canvas.width / 2,
  vpx = canvas.width / 2,
  vpy = canvas.height / 2,
  barVals = [],
  sineVal = 0;

for (var i = 0; i < 15; i++) {
  squares.push(new Square(-300 + (i * 200)));
}

//ctx.lineWidth = 2;
ctx.strokeStyle = ctxBars.strokeStyle = ctxBars.fillStyle = '#00FF00';

/* fake console stuff */
var commandStart = ['Performing DNS Lookups for',
    'Searching ',
    'Analyzing ',
    'Estimating Approximate Location of ',
    'Compressing ',
    'Requesting Authorization From : ',
    'wget -a -t ',
    'tar -xzf ',
    'Entering Location ',
    'Compilation Started of ',
    'Downloading '
  ],
  commandParts = ['Data Structure',
    'http://wwjd.com?au&2',
    'Texture',
    'TPS Reports',
    ' .... Searching ... ',
    'http://zanb.se/?23&88&far=2',
    'http://ab.ret45-33/?timing=1ww'
  ],
  commandResponses = ['Authorizing ',
    'Authorized...',
    'Access Granted..',
    'Going Deeper....',
    'Compression Complete.',
    'Compilation of Data Structures Complete..',
    'Entering Security Console...',
    'Encryption Unsuccesful Attempting Retry...',
    'Waiting for response...',
    '....Searching...',
    'Calculating Space Requirements '
  ],
  isProcessing = false,
  processTime = 0,
  lastProcess = 0;


function render() {
  ctx.clearRect(0, 0, canvas.width, canvas.height);

  squares.sort(function(a, b) {
    return b.dist - a.dist;
  });
  for (var i = 0, len = squares.length; i < len; i++) {
    squares[i].update();
    squares[i].render();
  }

  ctxBars.clearRect(0, 0, canvasBars.width, canvasBars.height);

  ctxBars.beginPath();
  var y = canvasBars.height / 6;
  ctxBars.moveTo(0, y);

  for (i = 0; i < canvasBars.width; i++) {
    var ran = (Math.random() * 20) - 10;
    if (Math.random() > 0.98) {
      ran = (Math.random() * 50) - 25
    }
    ctxBars.lineTo(i, y + ran);
  }

  ctxBars.stroke();

  for (i = 0; i < canvasBars.width; i += 20) {
    if (!barVals[i]) {
      barVals[i] = {
        val: Math.random() * (canvasBars.height / 2),
        freq: 0.1,
        sineVal: Math.random() * 100
      };
    }

    barVals[i].sineVal += barVals[i].freq;
    barVals[i].val += Math.sin(barVals[i].sineVal * Math.PI / 2) * 5;
    ctxBars.fillRect(i + 5, canvasBars.height, 15, -barVals[i].val);
  }

  requestAnimationFrame(render);
}

function consoleOutput() {
  var textEl = document.createElement('p');

  if (isProcessing) {
    textEl = document.createElement('span');
    textEl.textContent += Math.random() + " ";
    if (Date.now() > lastProcess + processTime) {
      isProcessing = false;
    }
  } else {
    var commandType = ~~(Math.random() * 4);
    switch (commandType) {
      case 0:
        textEl.textContent = commandStart[~~(Math.random() * commandStart.length)] + commandParts[~~(Math.random() * commandParts.length)];
        break;
      case 3:
        isProcessing = true;
        processTime = ~~(Math.random() * 5000);
        lastProcess = Date.now();
      default:
        textEl.textContent = commandResponses[~~(Math.random() * commandResponses.length)];
        break;
    }
  }

  outputConsole.scrollTop = outputConsole.scrollHeight;
  outputConsole.appendChild(textEl);

  if (outputConsole.scrollHeight > window.innerHeight) {
    var removeNodes = outputConsole.querySelectorAll('*');
    for (var n = 0; n < ~~(removeNodes.length / 3); n++) {
      outputConsole.removeChild(removeNodes[n]);
    }
  }

  setTimeout(consoleOutput, ~~(Math.random() * 200));
}

render();
consoleOutput();

window.addEventListener('resize', function() {
  canvas.width = (window.innerWidth / 3) * 2;
  canvas.height = window.innerHeight / 3;

  canvasBars.width = window.innerWidth / 3;
  canvasBars.height = canvas.height;

  outputConsole.style.height = (window.innerHeight / 3) * 2 + 'px';
  outputConsole.style.top = window.innerHeight / 3 + 'px';

  focal = canvas.width / 2;
  vpx = canvas.width / 2;
  vpy = canvas.height / 2;
  ctx.strokeStyle = ctxBars.strokeStyle = ctxBars.fillStyle = '#00FF00';
});
@font-face {
  font-family: 'Source Code Pro';
  font-style: normal;
  font-weight: 400;
  src: local('Source Code Pro'), local('SourceCodePro-Regular'), url(http://themes.googleusercontent.com/static/fonts/sourcecodepro/v4/mrl8jkM18OlOQN8JLgasDxM0YzuT7MdOe03otPbuUS0.woff) format('woff');
}
body {
  font-family: 'Source Code Pro';
  background: #000;
  color: #00FF00;
  margin: 0;
  font-size: 13px;
}
canvas {
  position: absolute;
  top: 0;
  left: 0;
}
.bars-and-stuff {
  left: 66.6%;
}
.output-console {
  position: fixed;
  overflow: hidden;
}
p {
  margin: 0
}
<canvas class='hacker-3d-shiz'></canvas>
<canvas class='bars-and-stuff'></canvas>
<div class="output-console"></div>


47
绘画/维修人员意识到我是程序员,而不仅仅是一些听音乐的人!我想知道这是否可以在技术专家的检查下幸存:P
sabithpocker 2014年

17
我想要它作为我的新屏保!实际上,您将如何在Ubuntu中做到这一点?

33
我坐在这个开放的多伦多公共图书馆里,发现后面的人看着我的屏幕。对于非技术人员来说,这看起来很“恐怖”。您能否使guihacker.com允许我们2将页面标题更改为所需的文字,以及是否可以添加自己的行(将以绿色文本显示)?我正在考虑使页面标题为“多伦多公共图书馆Internet访问”,并使绿线显示为“正在访问多伦多公共图书馆安全数据库..”,“正在访问用户名和密码...”,“已授予访问权限”。让我有些麻烦,但这会很有趣。
user2719875 2014年

37
在我的同伴开发人员问我要入侵的内容之前,该程序已经运行了30秒钟。我认为这算是成功,因此+1
MrTheWalrus

10
“ TPS报告” ...精采。
丹尼斯

111

Bash / coreutils

介绍第一个... 编译模拟器。通过此程序,您可以随时进行史诗般的办公椅剑战,甚至无需编写任何代码!

#!/bin/bash
collect()
{
    while read line;do
        if [ -d "$line" ];then
            (for i in "$line"/*;do echo $i;done)|sort -R|collect
            echo $line
        elif [[ "$line" == *".h" ]];then
            echo $line
        fi
    done
}

sse="$(awk '/flags/{print;exit}' </proc/cpuinfo|grep -o 'sse\S*'|sed 's/^/-m/'|xargs)"

flags=""
pd="\\"

while true;do
    collect <<< /usr/include|cut -d/ -f4-|
    (
        while read line;do
            if [ "$(dirname "$line")" != "$pd" ];then
                x=$((RANDOM%8-3))
                if [[ "$x" != "-"* ]];then
                    ssef="$(sed 's/\( *\S\S*\)\{'"$x,$x"'\}$//' <<< "$sse")"
                fi
                pd="$(dirname "$line")"
                opt="-O$((RANDOM%4))"
                if [[ "$((RANDOM%2))" == 0 ]];then
                    pipe=-pipe
                fi
                case $((RANDOM%4)) in
                    0) arch=-m32;;
                    1) arch="";;
                    *) arch=-m64;;
                esac
                if [[ "$((RANDOM%3))" == 0 ]];then
                    gnu="-D_GNU_SOURCE=1 -D_REENTRANT -D_POSIX_C_SOURCE=200112L "
                fi
                flags="gcc -w $(xargs -n1 <<< "opt pipe gnu ssef arch"|sort -R|(while read line;do eval echo \$$line;done))"
            fi
            if [ -d "/usr/include/$line" ];then
                echo $flags -shared $(for i in /usr/include/$line/*.h;do cut -d/ -f4- <<< "$i"|sed 's/h$/o/';done) -o "$line"".so"
                sleep $((RANDOM%2+1))
            else
                line=$(sed 's/h$//' <<< "$line")
                echo $flags -c $line"c" -o $line"o"
                sleep 0.$((RANDOM%4))
            fi
        done
    )
done

它使用中的数据/usr/include来创建逼真的编译日志。我太懒了,无法发出随机警告,因此只有一个-w标志。

随机样品:

gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc / xtcshared.c -o libiptc / xtcshared.o
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc / libip6tc.c -o libiptc / libip6tc.o
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc / libxtc.c -o libiptc / libxtc.o
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc / ipt_kernel_headers.c -o libiptc / ipt_kernel_headers.o
gcc -w -m64 -pipe -msse -msse2 -msse3 -O1 -c libiptc / libiptc.c -o libiptc / libiptc.o
gcc -w -O2 -m64 -pipe -msse -msse2 -msse3 -msse4_1 -msse4_2-共享的libiptc / ipt_kernel_headers.o libiptc / libip6tc.o libiptc / libiptc.o libiptc / libxtc.o libiptc / xipct-o。所以
gcc -w -m64 -pipe -O0 -msse -msse2 -msse3 -msse4_1 -c e2p / e2p.c -o e2p / e2p.o
gcc -w -msse -msse2 -msse3 -msse4_1 -m64 -pipe -O1-共享的e2p / e2p.o -o e2p.so
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0 / spice-widget-enums.c -o spice-client-gtk-2.0 / spice-widget-enums.o
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0 / spice-grabsequence.c -o spice-client-gtk-2.0 / spice-grabsequence.o
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0 / spice-gtk-session.c -o spice-client-gtk-2.0 / spice-gtk-session.o
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0 / spice-widget.c -o spice-client-gtk-2.0 / spice-widget.o
gcc -w -pipe -O0 -msse -msse2 -m64 -c spice-client-gtk-2.0 / usb-device-widget.c -o spice-client-gtk-2.0 / usb-device-widget.o
gcc -w -pipe -m64 -msse -msse2 -O1-共享的spice-client-gtk-2.0 / spice-grabsequence.o spice-client-gtk-2.0 / spice-gtk-session.o spice-client-gtk-2.0 /spice-widget-enums.o spice-client-gtk-2.0 / spice-widget.o spice-client-gtk-2.0 / usb-device-widget.o -o spice-client-gtk-2.0.so
gcc -w-管道-m64 -msse -msse2 -O1 -c search.c -o search.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / path.c -o cairomm-1.0 / cairomm-1.0 / cairomm / path.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / scaledfont.c -o cairomm-1.0 / cairomm / scaledfont.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / fontface.c -o cairomm-1.0 / cairomm / fontface.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / quartz_font.c -o cairomm-1.0 / cairomm / quartz_fonto。
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / win32_font.c -o cairomm-1.0 / cairomm / win32_fonto。
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / refptr.c -o cairomm-1.0 / cairomm / refptr.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / cairomm.c -o cairomm-1.0 / cairomm / cairomm.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / context.c -o cairomm-1.0 / cairomm / context.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / enums.c -o cairomm-1.0 / cairomm / enums.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / win32_surface.c -o cairomm-1.0 / cairomm / win32_surfaceo。
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / pattern.c -o cairomm-1.0 / cairomm / 1.0 / cairomm / pattern.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / types.c -o cairomm-1.0 / cairomm-1.0 / cairomm / types.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / matrix.c -o cairomm-1.0 / cairomm / matrix.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / quartz_surface.c -o cairomm-1.0 / cairomm / quartz_surfaceo。
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / exception.c -o cairomm-1.0 / cairomm / exception.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / device.c -o cairomm-1.0 / cairomm / device.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / surface.c -o cairomm-1.0 / cairomm / surface.o
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / xlib_surface.c -o cairomm-1.0 / cairomm / xlib_surfaceo
gcc -w -O0-管道-m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / fontoptions.c -o cairomm-1.0 / cairomm / fontoptions.o
gcc -w -O0 -pipe -m64 -msse -msse2 -msse3 -msse4_1 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -c cairomm-1.0 / cairomm / region.c -o cairomm-1.0 / cairomm / region.o
gcc -w -O0-管道-m64 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -msse -msse2 -msse3 -msse4_1-共享的cairomm-1.0 / cairomm / cairomm.o cairomm-1.0 / cairomm / context.o cairomm-1.0 /cairomm/device.o cairomm-1.0 / cairomm / enums.o cairomm-1.0 / cairomm / exception.o cairomm-1.0 / cairomm / fontface.o cairomm-1.0 / cairomm / fontoptions.o cairomm-1.0 / cairomm / matrix。 o cairomm-1.0 / cairomm / path.o cairomm-1.0 / cairomm / pattern.o cairomm-1.0 / cairomm / quartz_font.o cairomm-1.0 / cairomm / quartz_surface.o cairomm-1.0 / cairomm / refptr.o cairomm-1.0 / cairomm / region.o cairomm-1.0 / cairomm / scaledfont.o cairomm-1.0 / cairomm / surface.o cairomm-1.0 / cairomm / types.o cairomm-1.0 / cairomm / win32_font.o cairomm-1.0 / cairomm / win32_surface.o cairomm-1.0 / cairomm / xlib_surface.o -o cairomm-1.0 / cairomm.so
gcc -w -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -m64 -msse -O1 -pipe -shared cairomm-1.0 / *。o -o cairomm-1.0.so
gcc -w -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -m64 -msse -O1 -pipe -c ulockmgr.c -o ulockmgr.o
gcc -w -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -m64 -msse -O1 -pipe -c gshadow.c -o gshadow.o
gcc -w -O2 -msse -msse2 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -m64 -pipe -c dpkg / string.c -o dpkg / string.o
gcc -w -O2 -msse -msse2 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -m64 -pipe -c dpkg / fdio.c -o dpkg / fdio.o
gcc -w -O2 -msse -msse2 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -m64 -pipe -c dpkg / namevalue.c -o dpkg / namevalue.o
gcc -w -O2 -msse -msse2 -D_GNU_SOURCE = 1 -D_REENTRANT -D_POSIX_C_SOURCE = 200112L -m64 -pipe -c dpkg / macros.c -o dpkg / macros.o

4
一点也不差!对此感觉不太正确(HD保持完全安静吗?),但是对于不知情的观众来说,不太可能引起怀疑。虽然...什么,它正在编译libdrm?和sys/wait.o?? 什么...
停止了逆时针旋转

27
@leftaroundabout假设您有一个SSD。
mniip 2014年

36
为了使其更加真实,您应该每gcc行多次输出假的编译器警告。:)
monocell 2014年

3
您可能使用pkg-config提出了更真实的假gcc标志。
Brendan Long

3
@WChargin不会激活高清。
托尔比约恩Ravn的安德森

106

重击

无限显示随机的十六进制值,其中一些突出显示以使您感觉好像您在原始数据中执行复杂的搜索。

while true; do head -c200 /dev/urandom | od -An -w50 -x | grep -E --color "([[:alpha:]][[:digit:]]){2}"; sleep 0.5; done

在此处输入图片说明


6
哦,我喜欢这个!
SomeKittens 2014年

4
(对我来说,是bash的新手),但是在运行此行(mac osx,终端)时,我会在循环上获得此输出:od: illegal option -- w usage: od [-aBbcDdeFfHhIiLlOosvXx] [-A base] [-j skip] [-N length] [-t type] [[+]offset[.][Bb]] [file ...]
Sterling Archer 2014年

2
您的的版本od似乎不支持该 -w选项。您可以删除此选项,它只是在这里显示更多的数据列,以填充整个屏幕。
barjak 2014年

8
就个人而言,我更喜欢将其sleep 0.5更改为sleep.$[$RANDOM % 10]。这使它有点生涩,更像是真正的搜索。我确实喜欢它!
地下

4
让我想起了“ ca fe”永无止境的搜索:cat /dev/random | hexdump | grep "ca fe"
daviewales 2014年

102

很长的构建:

emerge openoffice

48
; _;
mniip

3
比铬长吗?
nyuszika7h 2014年

6
编译真实项目的问题是,如果发生错误,它将停止。可能我们应该将其置于无限循环中。
2014年

3
我们已经出现在Linux Mint中了吗?
2014年

3
在诸如Ubuntu和Mint之类的.deb系统上,您想要sudo apt-get build-dep libreoffice; apt-get source libreoffice; cd libreoffice*; while :; do nice dpkg-buildpackage -rfakeroot; done(您必须在第一次运行时对其进行照看,至少要等到真正的编译开始为止。随后的运行才需要while循环。)
Adam Katz 2015年

55

红宝石

这将:

  1. 从此站点获取随机代码代码审查(对于更具可读性,写得更好的代码)
  2. 使其看起来像您在键入此代码。
require 'open-uri'
require 'nokogiri'
site = "http://codereview.stackexchange.com/"
system 'cls'
system("color 0a")
5.times do
    begin
        id = rand(1..6000)
        url = "#{site}/a/#{id}"
        page = Nokogiri::HTML(open(url))
        code = page.css('code')[0].text
    end until code

    code.each_char  do |char|
        print char
        sleep rand(10) / 30.0
    end
end

这是基于从此处获取的代码的脚本:

require 'open-uri'
code = open("http://hackertyper.com/code.txt")
system 'cls'
system("color 0a")

code.each_char  do |char|
    print char
    sleep rand(10) / 30.0
 end

外观如下: 码


11
如果得到的代码在Brainf ** k,Golfscript或J中怎么办?这会引起一些怀疑。
user80551 2014年

39
最后,我精心安排的答案增加了后门的支出
PlasmaHH 2014年

1
也许stackoverflow会更好?
PyRulez 2014年

3
如果我通过将sleep行更改为来随机化速度(并使其更快),则每个打字的速度看起来都更加逼真sleep rand(10).to_f / 30
罗里·奥肯

3
我认为在Code Golf上使用Code Review代码是完美的。我一直认为Code Golf是Code Review的邪恶孪生,而且
我俩

52

让我们来看一个简单的bash脚本,该脚本通过逐行打印/ var / log /中标识为文本的每个文件的内容,使您看起来有些呆板,并有一些随机延迟,使它看起来像是在进行密集的工作。根据所命中的文件,它可以提供一些相当有趣的输出。

#/bin/bash
# this script helps you do hackerish stuff

if [ "$EUID" -ne 0 ]
then
  echo "Please run as root to be hackerish."
  exit
fi

# turn off globbing
set -f
# split on newlines only for for loops
IFS='
'
for log in $(find /var/log -type f); do
  # only use the log if it's a text file; we _will_ encounter some archived logs
  if [ `file $log | grep -e text | wc -l` -ne 0 ]
  then
    echo $log
    for line in $(cat $log); do
      echo $line
      # sleep for a random duration between 0 and 1/4 seconds to indicate hard hackerish work
      bc -l <<< $(bc <<< "$RANDOM % 10")" / 40" | xargs sleep
    done
  fi
done

确保您的终端主题看上去有点陈腐。这是一些坏蛋的例子(不知道这意味着什么,但看起来有点黑):

图片 图片


3
做得很好。屏幕截图示例很棒
SomeKittens 2014年

37
您是否知道您的私钥在这些屏幕截图上?
Hubert OG

27
哈哈,知道了!;-)
Hubert OG 2014年

4
(但是,严重的是,我没有阅读这些屏幕截图,所以我不知道实际存在的内容。)
Hubert OG 2014年

3
@HubertOG哇,你差点让我心脏病发作……; PI在任何地方都看不到,所以我以为我发疯了:O
Jwosty 2014年

49

Bash:无尽的git commit

当今计算机的一个问题是它们的速度非常快,因此即使编译任务也最终完成了。同样,鉴于脚本已运行很长时间,您可能会争辩说,脚本运行时实际上有可能继续处理其他事情。

为了解决这个问题,我们有以下程序。只是不时学习随机输入“ y”或“ n”。

当然,您需要具有一些新内容的git repo,但假设您偶尔进行实际工作,那应该不会有问题。

#!/bin/bash

while [ 1 ]; do
  git add -p
  git reset
done

12
我对这个CG条目感到最不安...它是+1或-1,但我仍然不知道哪一个!
vaxquis 2014年

37

重击

#!/bin/bash
function lazy {
    sudo apt-get update
    lazy
    }
lazy

这只会继续更新您的存储库。如果有人注意到,只需说您为一个新程序添加了一个新的仓库,并且您正在测试不同的仓库。这实际上不是伪造脚本,而是伪造命令。

注意:我不容忍工作效率低下,但是我喜欢实验。因此,我建议将此应用用于秘密生产。


5
很好,但是请注意该递归函数。
Digital Trauma 2014年

1
看起来像叉子炸弹!
Avinash R 2014年

2
@AvinashR不完全,没有分叉。
PyRulez 2014年

43
镜像主机现在讨厌您。
Caleb 2014年

9
“不完全,没有叉子。” 所以你说,只有炸弹?:-)
celtschk 2014年

28

C ++神经网络

编辑

可悲的是,我优化了这段代码:(使它的速度提高了2000倍……尽管如此,遗留代码仍然非常适合浪费时间!

原版的

实际上,我在卷积神经网络中开始了一个完美的项目!源代码和文档位于github上。第一步是创建一个新网络。

std::vector<int> numNeurons = { 500, 500, 2000, 10 };
std::vector<int> numMaps = { 1, 1, 1, 1 };

ConvolutionalNeuralNetwork neuralNetwork(numNeurons, numMaps, numNeurons, 
    std::vector<std::vector<int>>(), std::vector<std::vector<int>>());

现在我们已经有了一个包含300个神经元和1,250,000个突触的网络,让我们将其保存到文件中以确保我们不会失去在网络上取得的任何进步。

neuralNetwork.SaveToFile("test2.cnn");

这样就产生了一个68MB的文本文件,并花费了几个小时的轻松时间。现在,让我们用它来做一些有趣的事情!我将创建一个随机输入并开始对其进行区分。

std::vector<std::vector<float>> input;
for (int i = 0; i < 2; ++i)
    input.push_back(std::vector<float>{});

for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 3; ++j)
        input[i].push_back(rand() % 100);
neuralNetwork.SetInput(input);

对于图像来说,这是很小的输入,但是我们只是证明网络可以做些什么。下一步就是区别它!

Layer output = neuralNetwork.Discriminate();

对我来说,这还没有完成,已经运行了超过2天!然后,一旦获得该输出,就让我们再次反向运行它只是为了好玩。

Layer generatedOutput = neuralNetwork.Generate(output);

所有这些只是为了证明API可以工作,还没有计划。还没有为我执行此步骤,我已经等待了一段时间。燃烧了2天以上,这是我当前测试的粗略估计。这非常复杂,您需要花一两天的时间来努力工作,但是此后您可能再也不必工作了!

注意:如果您永远都不想再次工作,请尝试训练网络

neuralNetwork.LearnCurrentInput();

我什至没有时间浪费这个!

如果要展示所有正在发生的数据,请在函数中添加一些调用以仅显示正在发生的情况

新的构造函数

ConvolutionalNeuralNetwork::ConvolutionalNeuralNetwork(std::vector<int> neuronCountPerLayer, std::vector<int> featureMapsPerLayer, std::vector<int> featureMapDimensions, std::vector<std::vector<int>> featureMapConnections, std::vector<std::vector<int>> featureMapStartIndex)
{
std::map<SimpleNeuron, std::vector<Synapse>> childrenOf;
for (unsigned int i = 0; i < neuronCountPerLayer.size() - 1; ++i)
{
    Layer currentLayer;

    for (int j = 0; j < neuronCountPerLayer[i]; ++j)
    {
        std::vector<Synapse> parentOf;

        if (featureMapsPerLayer[i] == 1)
        {
            for (int n = 0; n < neuronCountPerLayer[i + 1]; ++n)
            {
                std::cout << "Adding new synapse, data: " << std::endl;

                SimpleNeuron current = SimpleNeuron(i + 1, j + 1);
                SimpleNeuron destination = SimpleNeuron(i + 2, n + 1);

                std::cout << "Origin: " << i + 1 << ", " << j + 1 << "; Destination: " << i + 2 << ", " << n + 1 << std::endl;

                Synapse currentParentSynapse = Synapse(current, current);
                Synapse currentChildSynapse = Synapse(destination, destination);

                currentChildSynapse.SetWeightDiscriminate(currentParentSynapse.GetWeightDiscriminate());
                currentChildSynapse.SetWeightGenerative(currentParentSynapse.GetWeightGenerative());

                std::cout << "Weights: Discriminative: " << currentChildSynapse.GetWeightDiscriminate() << "; Generative: " << currentChildSynapse.GetWeightGenerative() << std::endl;

                parentOf.push_back(currentParentSynapse);

                if (childrenOf.find(destination) != childrenOf.end())
                    childrenOf.at(destination).push_back(currentChildSynapse);
                else
                    childrenOf.insert(std::pair<SimpleNeuron, std::vector<Synapse>>(destination,
                    std::vector<Synapse>{ currentChildSynapse }));
            }
        }

        else
        {
            int featureMapsUp = featureMapsPerLayer[i + 1];
            int inFeatureMap = featureMapsPerLayer[i] / j;
            int connections = featureMapConnections[i][inFeatureMap];
            int startIndex = (neuronCountPerLayer[i + 1] / featureMapsUp) * featureMapStartIndex[i][inFeatureMap];
            int destinationIndex = startIndex + (neuronCountPerLayer[i + 1] / featureMapsUp) * connections;

            for (int n = startIndex; n < destinationIndex; ++n)
            {
                SimpleNeuron current = SimpleNeuron(i + 1, j + 1);
                SimpleNeuron destination = SimpleNeuron(i + 2, n + 1);

                std::cout << "Origin: " << i + 1 << ", " << j + 1 << "; Destination: " << i + 2 << ", " << n + 1 << std::endl;

                Synapse currentParentSynapse = Synapse(current, current);
                Synapse currentChildSynapse = Synapse(destination, destination);

                currentChildSynapse.SetWeightDiscriminate(currentParentSynapse.GetWeightDiscriminate());
                currentChildSynapse.SetWeightGenerative(currentParentSynapse.GetWeightGenerative());

                std::cout << "Weights: Discriminative: " << currentChildSynapse.GetWeightDiscriminate() << "; Generative: " << currentChildSynapse.GetWeightGenerative() << std::endl;

                parentOf.push_back(currentParentSynapse);

                if (childrenOf.find(destination) != childrenOf.end())
                    childrenOf.at(destination).push_back(currentChildSynapse);
                else
                    childrenOf.insert(std::pair<SimpleNeuron, std::vector<Synapse>>(destination,
                    std::vector<Synapse>{ currentChildSynapse }));
            }
        }

        std::cout << "Adding neuron" << std::endl << std::endl;

        if (childrenOf.find(SimpleNeuron(i + 1, j + 1)) != childrenOf.end())
            currentLayer.AddNeuron(Neuron(parentOf, childrenOf.at(SimpleNeuron(i + 1, j + 1))));
        else
            currentLayer.AddNeuron(Neuron(parentOf, std::vector<Synapse>{}));
    }

    std::cout << "Adding layer" << std::endl << std::endl << std::endl;

    AddLayer(currentLayer);
}

Layer output;

std::cout << "Adding final layer" << std::endl;

for (int i = 0; i < neuronCountPerLayer[neuronCountPerLayer.size() - 1]; ++i)
    output.AddNeuron(Neuron(std::vector<Synapse>(), childrenOf.at(SimpleNeuron(neuronCountPerLayer.size(), i + 1))));
AddLayer(output);
}

新的FireSynapse

float Neuron::FireSynapse()
{
float sum = 0.0f;

std::cout << "Firing Synapse!" << std::endl;

for (std::vector<Synapse>::iterator it = m_ChildOfSynapses.begin(); it != m_ChildOfSynapses.end(); ++it)
    sum += ((*it).GetWeightDiscriminate() * (*it).GetParent().GetValue());

std::cout << "Total sum: " << sum << std::endl;

float probability = (1 / (1 + pow(e, -sum)));

std::cout << "Probably of firing: " << probability << std::endl;

if (probability > 0.9f)
    return 1.0f;

else if (probability < 0.1f)
    return 0.0f;

else
{
    std::cout << "Using stochastic processing to determine firing" << std::endl;
    float random = ((rand() % 100) / 100);
    if (random <= probability)
        return 1.0f;
    else
        return 0.0f;
}
}

您现在将在控制台上获得大量输出。


4
现实生活中也需要+1。有趣的:)
乔治

1
Hahahaha的首字母拼写为“ CNN”
Nic Hartley

26

Python 3

#!/usr/bin/python3

import random
import time

first_level_dirs = ['main', 'home', 'usr', 'root', 'html', 'assets', 'files']
title_descs = ['page', 'script', 'interface', 'popup']
id_names = ['container', 'main', 'textbox', 'popup']
tag_names = ['div', 'textarea', 'span', 'strong', 'article', 'summary', 'blockquote', 'b']
autoclosing_tags = ['br', 'input']

def random_js_line():
    return random.choice([
        '      $("#%s").html("<b>" + $("#%s").text() + "</b>");' % (random.choice(id_names), random.choice(id_names)),
        '      $.get("t_%i.txt", function(resp) {\n        callback(resp);\n      });' % (int(random.random() * 50)),
        '      $("%s>%s").css({width: %i + "px", height: %i + "px"});' % (random.choice(tag_names), random.choice(tag_names), int(random.random() * 75), int(random.random() * 75)),
        '      for (var i = 0; i < count; i++) {\n        $("<div>").appendTo("#%s");\n      }' % (random.choice(id_names))
    ])

def random_js_lines():
    lines = [random_js_line() for _ in range(int(random.random() * 14) + 1)]
    return '\n'.join(lines)

def random_html_line():
    tag_name = random.choice(tag_names)
    return random.choice([
        '    <%s>id: %i</%s>' % (tag_name, int(random.random() * 1000), tag_name),
        '    <%s class="%s">\n      <%s/>\n    </%s>' % (tag_name, random.choice(first_level_dirs), random.choice(autoclosing_tags), tag_name),
        '    <div id="%s"></div>' % (random.choice(first_level_dirs))
    ])

def random_html_lines():
    lines = [random_html_line() for _ in range(int(random.random() * 9) + 1)]
    return '\n'.join(lines)

while True:
    print('creating /%s/%i.html' % (random.choice(first_level_dirs), int(random.random() * 1000)))
    time.sleep(random.random())
    lines = [
        '<!DOCTYPE html>',
        '<html lang="en">',
        '  <head>',
        '    <title>%s #%i</title>' % (random.choice(title_descs), int(random.random() * 100)),
        '    <script type="text/javascript" src="/js/assets/jquery.min.js"></script>',
        '    <script type="text/javascript">',
        random_js_lines(),
        '    </script>',
        '  </head>',
        '  <body>',
        random_html_lines(),
        '  </body>',
        '</html>'
    ]
    lines = [single_line for linegroup in lines for single_line in linegroup.split('\n')]
    for line in lines:
        print(line)
        time.sleep(random.random() / 10)
    print()
    time.sleep(random.random() / 2)

它输出许多行伪造的JS和HTML,并带有伪造的“加载”时间(延迟),使其看起来更加真实。

这可以并且将大大扩展!(那里有基本程序;我现在只需要添加更多内容)


这是它生成的一个示例“页面”(实际上是从旧版本的代码;完成后,我将使用新代码对其进行更新):

creating /assets/809.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>script #32</title>
    <script type="text/javascript" src="/js/assets/jquery.min.js"></script>
    <script type="text/javascript">
      $("#main").html("<b>" + $("#main").text() + "</b>");
      $("#textbox").html("<b>" + $("#container").text() + "</b>");
      $("#popup").html("<b>" + $("#textbox").text() + "</b>");
      $("#container").html("<b>" + $("#textbox").text() + "</b>");
      $.get("t_11.txt", function(resp) {
        callback(resp);
      });
      $("#main").html("<b>" + $("#textbox").text() + "</b>");
      $.get("t_14.txt", function(resp) {
        callback(resp);
      });
      $.get("t_1.txt", function(resp) {
        callback(resp);
      });
      $.get("t_34.txt", function(resp) {
        callback(resp);
      });
    </script>
  </head>
  <body>
    <span>id: 462</span>
    <textarea>id: 117</textarea>
  </body>
</html>

3
太棒了,等不及要看看添加的内容!
SomeKittens 2014年

嘿,这是一个漂亮的屁股。我的思维因世代相传的酷事而
狂奔

不仅是python3,还可以使用2.7
Hannes Karppila 2014年

1
很好。看起来很现实。
qwr

24

Node.js + BDD

看起来像是无止尽的BDD风格测试流。没有人可以责怪您进行测试!

    "use strict"
var colors = require("colors"),
    features = ["User", "Request", "Response", "Cache", "Preference", "Token", "Profile", "Application", "Security"],
    patterns = ["Factory", "Observer", "Manager", "Repository", "Impl", "Dao", "Service", "Delegate", "Activity"],
    requirements = ["return HTTP 403 to unauthorized users",
                    "accept UTF-8 input",
                    "return HTTP 400 for invalid input",
                    "correctly escape SQL",
                    "validate redirects",
                    "provide online documentation",
                    "select internationalized strings, based on locale",
                    "support localized date formats",
                    "work in IE6",
                    "pass W3C validation",
                    "produce valid JSON",
                    "work with screen readers",
                    "use HTML5 canvas where available",
                    "blink"],
    minTimeout = 100,
    maxTimeout = 1000,
    minRequirements = 2,
    maxRequirements = 6,
    skipThreshold = 0.1,
    failThreshold = 0.2


function randBetween(l, u) {
  return Math.floor(Math.random() * (u - l) + l) 
}

function choose(l) {
  return l[randBetween(0, l.length)]
}

function timeout() {
  return randBetween(minTimeout, maxTimeout)
}

function printFeature() {
  console.log("")
  var feature = choose(features) + choose(patterns)
  var article = /^[AEIOU]/.test(feature) ? "An " : "A "
  console.log(article + feature + " should")
  setTimeout(function() {
    var reqs = randBetween(minRequirements, maxRequirements)
    printRequirements(reqs)
  }, timeout())
}

function printRequirements(i) {
  if (i > 0) {
    var skipFailOrPass = Math.random()
    if (skipFailOrPass < skipThreshold) {
      console.log(("- " + choose(requirements) + " (SKIPPED)").cyan)
    } else if (skipFailOrPass < failThreshold) {
      console.log(("x " + choose(requirements) + " (FAILED)").red)
      console.log(("  - Given I am on the " + choose(features) + " page").green)
      console.log(("  - When I click on the " + choose(features) + " link").green)
      console.log(("  x Then the Log Out link should be visible in the top right hand corner").red)
    } else {
      console.log(("+ " + choose(requirements)).green)
    }
    setTimeout(function() {printRequirements(i - 1)}, timeout())
  } else {
    printFeature()
  }
}

printFeature()

更新资料

在我看来,如果您所有的测试都通过了,那看起来就很可疑了,所以我对其进行了更新,以包括一些失败的测试-结合“当下的时间”完成。

是的,我知道所有失败都有相同的信息。您确实需要修复该注销链接!

在此处输入图片说明


2
非常聪明,我可以确保通过测试我的代码而获得积分!不能太小心
SomeKittens 2014年

23

C#(Windows)

我向您展示全新的Memtest86 Simulator 2014!(因为在Windows下运行Memtest86非常有意义)

配有工作进度条和模式指示器!

这段代码广泛使用Console类,据我所知,它仅在Windows上可用。另外,我找不到显示真实处理器名称/频率和可用内存的方法,因此这些都是硬编码的。

屏幕截图: 在此处输入图片说明

编辑

若要检索处理器信息,可以使用Microsoft.Win32命名空间和RegistryKey类。

 // Processor information, add 'using Microsoft.Win32';
string processor = "";
RegistryKey processor_name = Registry.LocalMachine.OpenSubKey(@"Hardware\Description\System\CentralProcessor\0", RegistryKeyPermissionCheck.ReadSubTree);
        if (processor_name != null)
        {
            if (processor_name.GetValue("ProcessorNameString") != null)
            {
                processor = (string)processor_name.GetValue("ProcessorNameString");
            }
        }

代码(丑陋,我知道):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

class MemTestSim
{
    static void Main(string[] args)
    {
        Random r = new Random();
        int seconds = 0;
        int pass = 0;
        int test = 0;
        int testNumber = 0;

        string[] testNames = { "Address test, own Adress", "Moving inversions, ones & zeros", "Moving inversions, 8 bit pattern" };
        string[] pattern = { "80808080", "7f7f7f7f", "40404040", "bfbfbfbf", "20202020", "dfdfdfdf", "10101010", "efefefef", "08080808", "f7f7f7f7", "8f8f8f8f" };

        // Trick to stop the console from scrolling
        Console.SetWindowSize(80, 40);

        Console.Title = "Memtest86+ v2.11";
        Console.CursorVisible = false;

        // Dark Blue Background Color
        Console.BackgroundColor = ConsoleColor.DarkBlue;
        Console.Clear();

        // Green Title Text
        Console.BackgroundColor = ConsoleColor.DarkGreen;
        Console.ForegroundColor = ConsoleColor.Black;
        Console.Write("      Memtest86+ v2.11     ");

        // Gray on Blue Text and main window structure
        Console.BackgroundColor = ConsoleColor.DarkBlue;
        Console.ForegroundColor = ConsoleColor.Gray;
        Console.Write("| Pass " + pass + "%\n");
        Console.WriteLine("Intel Core i5 2290 MHz     | Test ");
        Console.WriteLine("L1 Cache:  128K   1058MB/s | Test #" + testNumber + "  [" + testNames[0] + "]");
        Console.WriteLine("L2 Cache:  512K   1112MB/s | Testing:  132K - 8192M  8192M");
        Console.WriteLine("L3 Cache: 3072K   1034MB/s | Pattern: ");
        Console.WriteLine("Memory  : 8192M            |---------------------------------------------------");
        Console.WriteLine("Chipset :  Intel i440FX");
        Console.WriteLine();
        Console.WriteLine();
        Console.WriteLine(" WallTime   Cached  RsvdMem   MemMap   Cache  ECC  Test  Pass  Errors  ECC Errs");
        Console.WriteLine(" ---------  ------  -------  --------  -----  ---  ----  ----  ------  --------");
        Console.WriteLine("   0:00:26   8192M      64K  e820-Std    on   off   Std     0       0");

        // Bottom Bar
        Console.SetCursorPosition(0, 24);
        Console.BackgroundColor = ConsoleColor.Gray;
        Console.ForegroundColor = ConsoleColor.DarkBlue;
        Console.WriteLine("(ESC)Reboot  (c)configuration  (SP)scroll_lock  (CR)scroll_unlock               ");


        Console.SetWindowSize(80, 25);

        // Reset text color
        Console.BackgroundColor = ConsoleColor.DarkBlue;
        Console.ForegroundColor = ConsoleColor.Gray;

        // FOREVER
        while (true)
        {
            TimeSpan time = TimeSpan.FromSeconds(seconds);

            // Running Time (WallTime)
            Console.SetCursorPosition(3, 11);
            string min = (time.Minutes < 10 ? "0" + time.Minutes : "" + time.Minutes);
            string sec = (time.Seconds < 10 ? "0" + time.Seconds : "" + time.Seconds);
            Console.Write(time.Hours + ":" + min + ":" + sec);

            // Test percentage
            Console.SetCursorPosition(34, 1);
            Console.Write((int)test + "%");

            // Test Progress Bar
            Console.SetCursorPosition(38, 1);
            for (int i = 0; i < test / 3; i++)
                Console.Write("#");

            Console.SetCursorPosition(38, 0);
            for (int i = 0; i < pass / 3; i++)
                Console.Write("#");

            // Test Number
            Console.SetCursorPosition(35, 2);
            Console.Write(testNumber + "  [" + testNames[testNumber] + "]        ");

            if (testNumber != 0)
            {
                Console.SetCursorPosition(38, 4);
                Console.Write(pattern[test / 10]);
            }
            else
            {
                Console.SetCursorPosition(38, 4);
                Console.Write("         ");
            }

            if (test >= 100)
            {
                test = 0;

                Console.SetCursorPosition(34, 0);
                Console.Write(pass + "%");

                Console.SetCursorPosition(34, 1);
                Console.Write("                                      ");
                testNumber++;
                pass += 2;

                if (testNumber == 2)
                    testNumber = 0;
            }

            Thread.Sleep(1000);
            test += r.Next(0, 3);
            seconds++;
        }
    }
}

7
为什么不只运行Memtest86?“我认为我在这里遇到了一些硬件问题,我想我
只得无所事事

20
@MadTux'因为您必须启动进入Memtest,这意味着没有猫图片。
Schilcote 2014年

1
System.Console在Mono上运行,我认为您只需要调整代码以适应任意控制台窗口大小
NothingsImpossible 2014年

8
您不能在VM中运行Memtest86吗?
科尔·约翰逊

3
我喜欢VM创意中的Memtest。
约翰


14

AHK

您在脚本中使用JavaScript生成大量访问器和更改器时假装键入。确保IDE(我在Notepad ++上对此进行了测试)是活动窗口。

如果需要,请指定变量列表和类名。我只是用过已经有的东西window.location

按esc退出。

当有人尝试与您通话时,请按数字键盘上的0暂停。

按ctrl + w(w代表工作)开始

^w::
    loop{
        variable_names  :=  "hash|host|hostname|href|origin|pathname|port|protocol|search"
        class_name  :=  "location"

        StringSplit, variable_names_array, variable_names, "|"

        loop, %variable_names_array0%{
            Random, delay, 80, 120
            SetKeyDelay, %delay%
            current :=  variable_names_array%a_index%
            Send, %class_name%.prototype.
            Random, r, 800, 1300
            Sleep, %r%
            Send, get_
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current%
            Random, r, 800, 1300
            Sleep, %r%
            Send, {space}={space}
            Random, r, 800, 1300
            Sleep, %r%
            Send, function(){{}{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {tab}
            Random, r, 800, 1300
            Sleep, %r%
            Send, return this.
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current%;{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {BackSpace}{}}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {enter}{enter}
            Random, r, 800, 1300
            Sleep, %r%

            Send, %class_name%.prototype.
            Random, r, 800, 1300
            Sleep, %r%
            Send, set_
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current%
            Random, r, 800, 1300
            Sleep, %r%
            Send, {space}={space}
            Random, r, 800, 1300
            Sleep, %r%
            Send, function(%current%){{}{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {tab}
            Random, r, 800, 1300
            Sleep, %r%
            Send, this.
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current% ={space}
            Random, r, 800, 1300
            Sleep, %r%
            Send, %current%;{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, return this;{enter}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {BackSpace}{}}
            Random, r, 800, 1300
            Sleep, %r%
            Send, {enter}{enter}
            Random, r, 800, 1300
            Sleep, %r%
        }
    }
return

esc::
    ExitApp
    return

numpad0::
    Pause, toggle
    return

14

重击

转储随机的物理内存块并查看内容。为此需要成为根。默认情况下,仅前1MB内存可用。dd默认块大小为512字节,可以使用选项进行更改,ibs=bytes但请记住另一个选择skip=$offset是随机选择一个块。dd发送来自的输出tr以删除非ASCII字符;仅评估2个字符或更长的唯一结果。

将找到的每个字符串与字典进行比较。如果未找到匹配项,它将尝试解码为base64。最后,返回所有评估的字符串。

还有其他一些与平台相关的选项需要注意,例如字典文件的位置(/ usr / share / dict / words),sleep是否接受浮点输入以及是否base64可用。

另外,请注意,将dd输出的统计信息输出到stderr,该信息通过管道传送到/ dev / null。如果出现严重错误(正在访问/ dev / mem ...),则stderr输出将不可见。

总的来说,它不是很有用,但是我学到了一些有关Linux内存的知识,编写这个脚本原来很有趣。

#!/bin/bash

offset=`expr $RANDOM % 512`
mem=`dd if=/dev/mem skip=$offset count=1 2>/dev/null| tr '[\000-\040]' '\n' | tr '[\177-\377'] '\n' | sort -u | grep '.\{2,\}'`

results=""

for line in $mem
do
    echo "Evaluating $line"
    greps=`grep "^$line" /usr/share/dict/words | head`

    if [ -n "$greps" ]
    then
        echo "Found matches."
        echo $greps
    else
        #echo "No matches in dictionary. Attempting to decode."
        decode=`echo "$line" | base64 -d 2>/dev/null`
        if [ $? -ne 1 ]
        then
            echo "Decode is good: $decode"
        #else
            #echo "Not a valid base64 encoded string."
        fi
    fi

    results+=" $line"

    # make it look like this takes a while to process
    sleep 0.5

done 

if (( ${#results} > 1 ))
then
    echo "Done processing input at block $offset: $results"
fi

有时,没有有趣的输出(全零)。有时只有几个字符串:

codegolf/work# ./s 
Evaluating @~
Evaluating 0~
Evaluating ne
Found matches.
ne nea neal neallotype neanic neanthropic neap neaped nearable nearabout
Done processing input at block 319:  @~ 0~ ne

有时实际上内存中有一些人类可读的东西(在我记录块偏移之前):

codegolf/work# ./s 
Evaluating grub_memset
Evaluating grub_millisleep
Evaluating grub_mm_base
Evaluating grub_modbase
Evaluating grub_named_list_find
Evaluating grub_net_open
Evaluating grub_net_poll_cards_idle
Evaluating grub_parser_cmdline_state
Evaluating grub_parser_split_cmdline
Evaluating grub_partition_get_name
Evaluating grub_partition_iterate
Evaluating grub_partition_map_list
Evaluating grub_partition_probe
Evaluating grub_pc_net_config
Evaluating grub_pit_wait
Evaluating grub_print_error
Evaluating grub_printf
Evaluating grub_printf_
Evaluating grub_puts_
Evaluating grub_pxe_call
Evaluating grub_real_dprintf
Evaluating grub_realidt
Evaluating grub_realloc
Evaluating grub_refresh
Evaluating grub_register_command_prio
Evaluating grub_register_variable_hook
Evaluating grub_snprintf
Evaluating grub_st
Evaluating grub_strchr
Evaluating _memmove
Done processing input:  grub_memset grub_millisleep grub_mm_base 
    grub_modbase grub_named_list_find grub_net_open grub_net_poll_cards_idle
    grub_parser_cmdline_state grub_parser_split_cmdline 
    grub_partition_get_name grub_partition_iterate grub_partition_map_list 
    grub_partition_probe grub_pc_net_config grub_pit_wait grub_print_error 
    grub_printf grub_printf_ grub_puts_ grub_pxe_call grub_real_dprintf 
    grub_realidt grub_realloc grub_refresh grub_register_command_prio 
    grub_register_variable_hook grub_snprintf grub_st grub_strchr _memmove

最后一个示例运行显示了格式错误的grep输入,字典匹配以及成功的base64解码(再次记录块偏移之前):

codegolf/work# ./s 
Evaluating <!
Evaluating !(
Evaluating @)
Evaluating @@
Evaluating $;
Evaluating '0@
Evaluating `1
Evaluating 1P$#4
Evaluating )$2
Evaluating -3
Evaluating 3HA
Evaluating 3N
Evaluating @@9
Evaluating 9@
Evaluating 9Jh
Evaluating \9UK
grep: Invalid back reference
Evaluating a#
Evaluating CX
Evaluating ?F
Evaluating !H(
Evaluating +%I
Evaluating Io
Found matches.
Io Iodamoeba Ione Ioni Ionian Ionic Ionicism Ionicization Ionicize Ionidium
Evaluating Kj
Found matches.
Kjeldahl
Evaluating l#
Evaluating L6qh
Decode is good: /��
Evaluating O%
Evaluating OX
Evaluating PR
Evaluating .Q
Evaluating Q4!
Evaluating qQ
Evaluating )u
Evaluating Ua
Found matches.
Uaraycu Uarekena Uaupe
Evaluating $v
Evaluating )V
Evaluating V8
Evaluating V,B~
Evaluating wIH
Evaluating xU
Evaluating y@
Evaluating @z
Evaluating Z0
Evaluating zI
Evaluating Z@!QK
Done processing input:  <! !( @) @@ $; '0@ `1 1P$#4 )$2 -3 3HA 3N
    @@9 9@ 9Jh \9UK a# CX ?F !H( +%I Io Kj l# L6qh O% OX PR .Q Q4!
    qQ )u Ua $v )V V8 V,B~ wIH xU y@ @z Z0 zI Z@!QK

你如何运行这个?我将其倾倒入script.sh,对其进行了chmod +x处理,但它刚刚退出。sudo也无济于事。
Octavia Togami 2014年

听起来这mem=行什么也没返回。您必须检查并确保管道之间的命令的每个部分实际上都在返回内容。

好吧,我会做的。
Octavia Togami 2014年

第一次只运行了5秒钟,然后打印了12行,随后每隔0.1秒钟打印一次,没有输出。
迈克

13

Windows批处理

@echo off

set /p hax="How much haxx0rz: " %=%
set /p haxx="How quick haxx0rz (seconds): " %=%

FOR /L %%I IN (1, 1, %hax%) DO (
START cmd /k "COLOR A&&tree C:\"
timeout %haxx%
)

这是一个玩笑脚本,为了让它看起来像90年代的黑客电影中的某种东西,我一直与我在一起。我通常在远程连接到计算机时使用它来吓跑人们。


2
他正在将病毒下载到整个系统上!
qwr

12

重击

寻找咖啡馆的永无止境。

我很久以前就在网上找到了:

cat /dev/urandom | hexdump | grep "ca fe"

尝试改用urandom。
爱丽丝·赖尔

啊...我在Mac上进行了测试,而Mac同时具有randomurandom
daviewales 2014年

5
/dev/random确实存在,但它比/dev/urandom通过仅在存在熵的情况下仅生成数字更安全。一旦用完,它就会停止。/dev/urandom不会这样做,也永远不会停止输出。
地下

为什么它永无止境?今天第二次,我感到很愚蠢。
Daniel W.

1
/dev/urandom是一个“文件”,它不断向馈送随机数catcat然后将其通过管道传送到hexdump等等,等等
daviewales 2014年

11

Python 2.7

无尽的测试套件

在目录树中的所有文件上“运行”一组“单元测试”。遍历所有子目录。从头到尾重新开始。

打印运行状态:

============================= entering . =============================
------------------------ test_line_numbers.py ------------------------
Ran 18 tests in 3.23707662572 seconds, 0 errors
---------------------------- test_main.c ----------------------------
Ran 26 tests in 1.3365194929 seconds, 0 errors
--------------------------- test_parser.c ---------------------------
Ran 8 tests in 1.61633904378 seconds, 0 errors
--------------------------- test_README.c ---------------------------
Ran 12 tests in 2.27466813182 seconds, 0 errors
4 modules OK (0 failed)
=========================== entering ./lib ===========================

...

使它变得比所需的更为复杂,并希望更加现实的功能:

  • 测试次数和测试时间与文件大小成正比。
  • 将非源代码文件扩展名转换为已知的文件扩展名。修改CodeExtensions以添加更多已知类型。
    • 根据看到的实际语言文件的频率选择新的扩展名,因此,如果硬盘驱动器中装有Ruby,就不会看到您测试Python代码。
  • 跳过. “ test_.bashrc.js”之类的无首选项的文件
import os,random,time,collections

CodeExtensions = ('.py', '.c','.cpp','.rb','.js','.pl','.cs','.el')
last_exts = collections.deque(CodeExtensions[:1],100)
maxlen=0

def maketestname(filename):
    root,ext = os.path.splitext(filename)
    if ext in CodeExtensions:
        last_exts.append(ext)
    else:
        ext = random.choice(last_exts)
    return 'test_'+root+ext

def banner(char,text,width=70):
    bar = char*((width-len(text)-2)/2)
    return "{} {} {}".format(bar,text,bar)

def scaledrand(scale,offset):
    return random.random()*scale+random.randrange(offset)

while True:
    for dirname, subdirs, files in os.walk('.'):
        print banner('=',"entering {}".format(dirname))
        skipped = 0
        for filename in files:
            if filename[0] is not '.':
                testfilename = maketestname(filename)
                print banner('-',testfilename)
                filelen = os.path.getsize(os.path.join(dirname,filename))
                maxlen = max(maxlen,filelen)
                ntests = int(scaledrand(20*filelen/maxlen,10))
            testtime = scaledrand(ntests/5.0,2)
            time.sleep(testtime)                
            else:
                skipped+=1
                continue

            print "Ran {} tests in {} seconds, {} errors".format(ntests,testtime,0)
        print "{} modules OK ({} failed)\n".format(len(files)-skipped,0)

1
您也可以只运行Python回归测试,该测试与大多数Python安装程序捆绑在一起。
nneonneo 2014年

但是那些最终完成了。
AShelly 2014年

2
那么您可以...循环运行它们!
nneonneo 2014年

1
我还认为,测试与项目相关名称的文件比测试Python源代码更可疑。我猜我们大多数人都不专业地维护Python ...
AShelly 2014年

11

Java + Guava 16(Guava不是超级必要,但它使某些事情的编写变得不那么烦人)。

好吧,你应该在工作吗?实际编写真正的Java代码,实际编译的程序怎么样(尽管它做的并不多)。

演示动画很困难,但是该程序使用默认字典(250个常用英语单词)或换行符分隔的文件(作为命令行参数)来编写Java程序,然后一次将其键入到控制台中一个字符以人类看来的速度。请确保自己运行它,因为此帖子并没有道理。完成后,将等待1分钟,然后在控制台上打印很多空白行,然后重新开始。我试图编写它以使各种参数合理可调。

另外,通常我会将其放入多个文件中,但是为了使运行更容易,我将所有类都混在一起了。

package org.stackoverflow.ppcg;

import java.io.*;
import java.util.*;

import com.google.common.base.CaseFormat;
import com.google.common.base.Converter;
import com.google.common.collect.Lists;

public class CodeGenerator {
    public static final Converter<String, String> TOUPPER =
            CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_CAMEL);
    public static final Converter<String, String> TOLOWER =
            CaseFormat.UPPER_CAMEL.converterTo(CaseFormat.LOWER_CAMEL);

    public static final String[] TYPES = new String[]{
        "int", "long", "double", "String"
    };

    public static final List<String> DEFAULT_LIST = Arrays.asList(new String[]{
            "the", "and", "for", "you", "say", "but", "his", "not", "she", "can",
            "who", "get", "her", "all", "one", "out", "see", "him", "now", "how",
            "its", "our", "two", "way", "new", "day", "use", "man", "one", "her",
            "any", "may", "try", "ask", "too", "own", "out", "put", "old", "why",
            "let", "big", "few", "run", "off", "all", "lot", "eye", "job", "far",
            "have", "that", "with", "this", "they", "from", "that", "what", "make", "know",
            "will", "time", "year", "when", "them", "some", "take", "into", "just", "your",
            "come", "than", "like", "then", "more", "want", "look", "also", "more", "find",
            "here", "give", "many", "well", "only", "tell", "very", "even", "back", "good",
            "life", "work", "down", "call", "over", "last", "need", "feel", "when", "high",
            "their", "would", "about", "there", "think", "which", "could", "other", "these", "first",
            "thing", "those", "woman", "child", "there", "after", "world", "still", "three", "state",
            "never", "leave", "while", "great", "group", "begin", "where", "every", "start", "might",
            "about", "place", "again", "where", "right", "small", "night", "point", "today", "bring",
            "large", "under", "water", "write", "money", "story", "young", "month", "right", "study",
            "people", "should", "school", "become", "really", "family", "system", "during", "number", "always",
            "happen", "before", "mother", "though", "little", "around", "friend", "father", "member", "almost",
            "change", "minute", "social", "follow", "around", "parent", "create", "others", "office", "health",
            "person", "within", "result", "change", "reason", "before", "moment", "enough", "across", "second",
            "toward", "policy", "appear", "market", "expect", "nation", "course", "behind", "remain", "effect",
            "because", "through", "between", "another", "student", "country", "problem", "against", "company", "program",
            "believe", "without", "million", "provide", "service", "however", "include", "several", "nothing", "whether",
            "already", "history", "morning", "himself", "teacher", "process", "college", "someone", "suggest", "control",
            "perhaps", "require", "finally", "explain", "develop", "federal", "receive", "society", "because", "special",
            "support", "project", "produce", "picture", "product", "patient", "certain", "support", "century", "culture"
    });

    private static final int CLASS_NAME_LENGTH = 2;

    private final WordList wordList;
    private final Appendable out;
    private final Random r = new Random();

    private CodeGenerator(WordList wordList, Appendable out) {
        this.wordList = wordList;
        this.out = out;
    }

    public static void main(String... args) throws Exception {
        List<?> wordSource = getWords(args);
        WordList list = new WordList(wordSource);
        SleepingAppendable out = new SleepingAppendable(System.out);
        CodeGenerator generator = new CodeGenerator(list, out);
        while(!Thread.interrupted()) {
            generator.generate();
            try {
                Thread.sleep(60000);
            } catch (InterruptedException e) {
                break;
            }
            out.setSleeping(false);
            for(int i = 0; i < 100; i++) {
                out.append(System.lineSeparator());
            }
            out.setSleeping(true);
        }
    }

    private static List<?> getWords(String[] args) {
        if(args.length > 0) {
            try {
                return getListFromFile(args[0]);
            } catch(IOException e) { }
        }
        return DEFAULT_LIST;
    }

    private static List<Object> getListFromFile(String string) throws IOException {
        List<Object> newList = Lists.newArrayList();

        File f = new File(string);
        Scanner s = new Scanner(f);

        while(s.hasNext()) {
            newList.add(s.nextLine());
        }

        return newList;
    }

    private void generate() throws IOException {
        String className = beginClass();
        List<Field> finalFields = generateFields(true);
        printFields(finalFields);
        out.append(System.lineSeparator());
        List<Field> mutableFields = generateFields(false);
        printFields(mutableFields);
        out.append(System.lineSeparator());
        printConstructor(className, finalFields);
        printGetters(finalFields);
        printGetters(mutableFields);
        printSetters(mutableFields);
        endClass();
    }

    private void printGetters(List<Field> fields) throws IOException {
        for(Field f : fields) {
            out.append(System.lineSeparator());
            f.printGetter(out);
        }
    }

    private void printSetters(List<Field> fields) throws IOException {
        for(Field f : fields) {
            out.append(System.lineSeparator());
            f.printSetter(out);
        }
    }

    private void printConstructor(String className, List<Field> finalFields) throws IOException {
        out.append("\tpublic ").append(className).append('(');
        printArgs(finalFields);
        out.append(") {").append(System.lineSeparator());
        for(Field f : finalFields) {
            f.printAssignment(out);
        }
        out.append("\t}").append(System.lineSeparator());
    }

    private void printArgs(List<Field> finalFields) throws IOException {
        if(finalFields.size() == 0) return;

        Iterator<Field> iter = finalFields.iterator();

        while(true) {
            Field next = iter.next();
            next.printTypeAndName(out);
            if(!iter.hasNext()) break;
            out.append(", ");
        }
    }

    private List<Field> generateFields(boolean isfinal) {
        int numFields = r.nextInt(3) + 2;
        List<Field> newFields = Lists.newArrayListWithCapacity(numFields);
        for(int i = 0; i < numFields; i++) {
            String type = TYPES[r.nextInt(4)];
            newFields.add(new Field(type, wordList.makeLower(r.nextInt(2) + 1), isfinal));
        }
        return newFields;
    }

    private void printFields(List<Field> finalFields) throws IOException {
        for(Field f : finalFields) {
            f.printFieldDeclaration(out);
        }
    }

    private String beginClass() throws IOException {
        out.append("public class ");
        String className = wordList.nextClassName(CLASS_NAME_LENGTH);
        out.append(className).append(" {").append(System.lineSeparator());

        return className;
    }

    private void endClass() throws IOException {
        out.append("}");
    }

    private static class WordList {
        private final Random r = new Random();

        private final List<?> source;

        private WordList(List<?> source) {
            this.source = source;
        }

        private String makeUpper(int length) {
            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < length; i++) {
                sb.append(randomWord());
            }
            return sb.toString();
        }

        private String makeLower(int length) {
            return TOLOWER.convert(makeUpper(length));
        }

        private String randomWord() {
            int sourceIndex = r.nextInt(source.size());
            return TOUPPER.convert(source.get(sourceIndex).toString().toLowerCase());
        }

        public String nextClassName(int length) {
            return makeUpper(length);
        }
    }

    private static class Field {
        private final String type;
        private final String fieldName;
        private final boolean isfinal;

        Field(String type, String fieldName, boolean isfinal) {
            this.type = type;
            this.fieldName = fieldName;
            this.isfinal = isfinal;
        }

        void printFieldDeclaration(Appendable appendable) throws IOException {
            appendable.append("\tprivate ");
            if(isfinal) appendable.append("final ");
            printTypeAndName(appendable);
            appendable.append(';').append(System.lineSeparator());
        }

        void printTypeAndName(Appendable appendable) throws IOException {
            appendable.append(type).append(' ').append(fieldName);
        }

        void printGetter(Appendable appendable) throws IOException {
            appendable.append("\tpublic ");
            appendable.append(type).append(" get").append(TOUPPER.convert(fieldName));
            appendable.append("() {").append(System.lineSeparator());
            appendable.append("\t\treturn ").append(fieldName).append(';');
            appendable.append(System.lineSeparator()).append("\t}").append(System.lineSeparator());
        }

        void printSetter(Appendable appendable) throws IOException {
            appendable.append("\tpublic void set");
            appendable.append(TOUPPER.convert(fieldName));
            appendable.append("(").append(type).append(' ').append(fieldName);
            appendable.append(") {").append(System.lineSeparator());
            printAssignment(appendable);
            appendable.append("\t}").append(System.lineSeparator());            
        }

        void printAssignment(Appendable appendable) throws IOException {
            appendable.append("\t\tthis.").append(fieldName).append(" = ").append(fieldName);
            appendable.append(';').append(System.lineSeparator());
        }
    }

    private static class SleepingAppendable implements Appendable {
        private Random r = new Random();
        private Appendable backing;

        private boolean sleeping = true;

        public SleepingAppendable(Appendable backing) {
            this.backing = backing;
        }

        @Override
        public Appendable append(CharSequence csq) throws IOException {
            return append(csq, 0, csq.length());
        }

        @Override
        public Appendable append(CharSequence csq, int start, int end)
                throws IOException {
            for(int i = start; i < end; i++) {
                append(csq.charAt(i));
            }

            sleep(100, 300);

            return this;
        }

        @Override
        public Appendable append(char c) throws IOException {
            sleep(170, 80);

            backing.append(c);

            return this;
        }


        private void sleep(int base, int variation) {
            if(!sleeping) return;
            try {
                Thread.sleep((long) (r.nextInt(80) + 70));
            } catch (InterruptedException e) {
            }
        }

        public boolean isSleeping() {
            return sleeping;
        }

        public void setSleeping(boolean sleeping) {
            this.sleeping = sleeping;
        }
    }
}

示例程序输出(仅一个程序)

public class GetGroup {
    private final double thoughRight;
    private final double socialYear;
    private final double manOne;
    private final int appear;

    private double man;
    private double comeHis;
    private double certain;

    public GetGroup(double thoughRight, double socialYear, double manOne, int appear) {
        this.thoughRight = thoughRight;
        this.socialYear = socialYear;
        this.manOne = manOne;
        this.appear = appear;
    }

    public double getThoughRight() {
        return thoughRight;
    }

    public double getSocialYear() {
        return socialYear;
    }

    public double getManOne() {
        return manOne;
    }

    public int getAppear() {
        return appear;
    }

    public double getMan() {
        return man;
    }

    public double getComeHis() {
        return comeHis;
    }

    public double getCertain() {
        return certain;
    }

    public void setMan(double man) {
        this.man = man;
    }

    public void setComeHis(double comeHis) {
        this.comeHis = comeHis;
    }

    public void setCertain(double certain) {
        this.certain = certain;
    }
}

另一个示例输出:

public class TryControl {
    private final int over;
    private final double thatState;
    private final long jobInto;
    private final long canPut;

    private int policy;
    private int neverWhile;

    public TryControl(int over, double thatState, long jobInto, long canPut) {
        this.over = over;
        this.thatState = thatState;
        this.jobInto = jobInto;
        this.canPut = canPut;
    }

    public int getOver() {
        return over;
    }

    public double getThatState() {
        return thatState;
    }

    public long getJobInto() {
        return jobInto;
    }

    public long getCanPut() {
        return canPut;
    }

    public int getPolicy() {
        return policy;
    }

    public int getNeverWhile() {
        return neverWhile;
    }

    public void setPolicy(int policy) {
        this.policy = policy;
    }

    public void setNeverWhile(int neverWhile) {
        this.neverWhile = neverWhile;
    }
}

9
您已经为仍然用代码行付款的任何人制作了一种全自动的货币印刷机-太好了!
菲利普

9

重击

从随机源文件中以随机间隔输出一些注释,然后输出一个随机生成的无所事事进度条。

#!/bin/bash

# The directory to extract source comments from
srcdir=~/src/php-src/

# Generate a status bar that lasts a random amount of time.
# The actual amount of time is somewhere between 1.5 and 30
# seconds... I think. I fudged this around so much it's hard to tell.
function randstatus() {
    bsize=4096
    r_rate=$(echo "$RANDOM/32767 * $bsize * 1.5 + $bsize / 4" | bc -l | sed 's/\..*$//')
    r_min=3
    r_max=15
    r_val=$(($r_min + $RANDOM % $(($r_max - $r_min)) ))
    i=0
    dd if=/dev/urandom bs=$bsize count=$r_val 2> /dev/null | pv -L $bsize -s $(($r_val * bsize)) > /dev/null
}

# Picks a random .c file from the given directory, parses
# out one-line comments, and outputs them one by one with a
# random delay between each line.
function randout() {
    r_file=$(find $1 -name '*.c' | sort -R | head -n 1)
    echo "# $r_file"
    grep '^\s*/\*.*\*/\s*$' $r_file | sed 's:[/\*]::g' | sed -e 's:^\s\+::' -e 's:\s\+$::' | sed -e 's:^\W\+::' | grep -v '^$' | while read line; do
        echo $line
        sleep $(printf "%0.2f" $(echo "$((($RANDOM%4)+1))/4" | bc -l))
    done
}

while true; do
    randout $srcdir
    randstatus
    # sleep here to make it easier to break out of the 'while read' loop
    sleep 2
done

输出:

# /home/jerkface/src/php-src/sapi/fpm/fpm/fpm_shm.c
Id: fpm_shm.c,v 1.3 20080524 17:38:47 anight Exp $
c) 2007,2008 Andrei Nigmatulin, Jerome Loyet
MAP_ANON is deprecated, but not in macosx
  32kB 0:00:08 [3.97kB/s] [====================================================================>] 100%
# /home/jerkface/src/php-src/ext/mbstring/mb_gpc.c
Id$
includes
mbfl_no_encoding _php_mb_encoding_handler_ex()
split and decode the query
initialize converter
auto detect
convert encoding
we need val to be emalloc()ed
add variable to symbol table
SAPI_POST_HANDLER_FUNC(php_mb_post_handler)
  12kB 0:00:03 [4.02kB/s] [===============>                                                      ] 24% ETA 0:00:09

1
聪明!受到更多关注已经有点晚了,但是请从我这里拿走最高的五分。
SomeKittens

@SomeKittens该脚本的真正天才在于,对其进行处理看起来更像是实际工作。; D
Sammitch 2014年

7

Rsync表格BASH

 rsync -n -avrIc --verbose  ~ ~ | sed s/"(DRY RUN)"/""/g    
# Note the space at the beginning of the above line,

rsync-快速,通用,远程(和本地)文件复制工具 ...使用 -n可以进行运行,仅尝试执行,不真正执行并显示发生了什么。
在这种情况下,请尝试检查是否更新主目录(和子文件夹)的所有文件。
当然,如果您具有root用户访问权限,则可以在文件系统的更大部分上运行它。

笔记:

  1. 如果HISTCONTROL=ignoreboth或者至少HISTCONTROL=ignorespace在您的bash会话中,如果您的bash历史记录之前带有空格,则将不记得该命令。(您不能在历史记录日志中向上推并在屏幕上查看它)。
  2. | sed s/"(DRY RUN)"/""/g将通过管道传递输出,sed这将擦除(DRY RUN)rsync输出末尾的文本。如果经过专家检查,您可以说您确实在这样做,而不仅仅是测试。
  3. -avrIc您可以更改这些选项,选中man rsync,但不要删除-n,否则您应该遇到严重的问题,如果您以root用户身份运行,甚至更多8-O

6

猛击下的Maven

Maven非常适合这种任务;-)

while true;
do mvn -X archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false;
done

6

眼镜蛇

这将打开一个控制台窗口,该窗口循环遍历各种伪造的对象和各种事物,并增加遍历次数和每次遍历的进度。每个增量等待一个小的随机时间,以模拟实际的计算延迟。

class Does_Nothing_Useful
    var _rng as Random = Random()
    var _hash
    var _pass
    var _names as String[] = @['Vector', 'Object', 'File', 'Index', 'Report', 'Library', 'Entry', 'Log', 'Resource', 'Directory']
    def main
        while true
            .refresh
            name as String = _names[_rng.next(_names.length)] + ' ' + _hash.toString
            for i in _pass
                progress as decimal = 0
                while progress < 100000
                    progress += _rng.next(1000)
                    print name + '; pass', i, ' : ', progress/1000
                    wait as int = 0
                    for n in _rng.next(50), wait += _rng.next(1,100)
                    System.Threading.Thread.sleep(wait)
                print name + '; pass', i, '--FINISHED--'
                print ''
                System.Threading.Thread.sleep(_rng.next(1000,17500))
            print name, '--EVAL COMPLETE--'
            print ''
            System.Threading.Thread.sleep(_rng.next(12500,30000))
    def refresh
        _hash = _rng.next.getHashCode
        _pass = _rng.next(256)
        print '--LOADING NEXT TARGET--'
        print ''
        System.Threading.Thread.sleep(_rng.next(12500,30000))

1
您需要整个周末来完成此工作,所以请花点时间。
SomeKittens 2014年

1
这是什么眼镜蛇语言,它看起来像是Python和C#的混蛋,哈哈(虽然看起来确实确实有一些有趣的功能),+
托马斯(Thomas

1
@Thomas大多数情况下,它是使用Python式语法的C#(当前没有LINQ)。我曾经有过最愉快的默认编译器之一。
非常

那么您是否最终完成了此代码?
rayryeng

4

我写了一个愚蠢的python脚本来做一次。叫做“ ProgramAboutNothing” ...我不确定这是否令人信​​服,但只花了大约10分钟。它只是输出描述它在做什么的随机句子……我可能为此选择了更好的单词,看起来更令人信服,但我从未真正使用过它。我想如果有人要使用它,他们可以对其进行编辑,然后在列表中添加自己的单词。Sim City的粉丝可能会注意到一些熟悉的东西。:P

from random import randrange
from time import sleep

nouns = ["bridge", "interface", "artifact", "spline"]
verbs = ["building", "articulating", "reticulating", "compiling", "analyzing"]
adjectives = ["mix", "abstract", "essential"]

while True:
    one = randrange(0,5)
    two = randrange(0,4)
    print "%s %s" % (verbs[one], nouns[two]),
    sleep(randrange(0,500)/100)
    print ".",
    sleep(randrange(0,500)/100)
    print ".",
    sleep(randrange(0,500)/100)
    print ".\n",
    loop = randrange(0,50)
    one = randrange(0,5)
    for i in range(loop):
        two = randrange(0,4)
        three = randrange(0,3)
        print "%s %s %s" % (verbs[one], nouns[two], adjectives[three]),
        sleep(randrange(0,250)/100)
        print ".",
        sleep(randrange(0,250)/100)
        print ".",
        sleep(randrange(0,250)/100)
        print ".\n",

1
也许您正在使用Python 3?尝试在打印语句周围添加括号,如下所示:print( ... )
daviewales 2014年

1
@daviewales ninja'd:P
路加福音

1
@Luke我刚刚Python 3.4.1为Windows 安装。我无法使用Python编程,但是我对您的小程序感兴趣...
Mathlight 2014年

1
@Mathlight准备不知所措。:P
路加福音

1
@luke,现在正在工作。我印象深刻^ _ ^
Mathlight 2014年

4

这个怎么样?它将每1秒钟下载codegolf HTML数据。因此,只要有新问题出现,数据就会一直在变化。同时,它看起来就像是您正在从网站上下载一些关键数据一样。

while true; do     
sleep 1;     
curl "codegolf.stackexchange.com" -s |  w3m -dump -T text/html; 
done


2

这是一个C ++编译器模拟(用C#编写):

using System;
using System.Collections.Generic;
using System.Management;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Reflection;

class FakeCompiler {
    static void DoPrint(string txt) {
        Console.WriteLine("Compiling " + txt);
        Thread.Sleep(1000);
    }
    static string Extract(string TypeName) {
        string rt = TypeName.Split(new Char[] {'.'})[ TypeName.Split(new Char[] {'.'}).Length - 1 ];
        if (rt.Contains("+")) {
            rt = rt.Split(new char[] { '+' })[1];
        }
        if (rt.Contains("[")) {
            rt = rt.Split(new char[] { '[' })[0];
        }
        return rt;
    }
    static void DoCompileSingleFile(string _Type_Name) {
        string print = Extract(_Type_Name);
        DoPrint(print + ".h");
        DoPrint(print + ".cpp");
    }
    static Type[] DoFakeCompile_Assembly(string _AssemblyFileName) {
        System.Reflection.Assembly _asm = System.Reflection.Assembly.Load(_AssemblyFileName);
        Type[] _ts = _asm.GetTypes();
        for (int h = 0; h < 15; ++h) {
            DoCompileSingleFile(_ts[h].ToString());
        }
        return _ts;
    }
    static void DoFakeLinkErrors(Type[] t) {
        Console.WriteLine("linking..");
        Thread.Sleep(2000);
        MethodInfo[] mi;
        for (int i = 0; i < t.Length; ++i) {
            mi = t[i].GetMethods();
            for (int j = 0; j < mi.Length; ++j) {
                Console.WriteLine("Link Error: The object {@!" + mi[j].ToString().Split(new char[] {' '})[0] + "#$? is already defined in " + Extract(t[i].ToString()) + ".obj");
                Thread.Sleep(200);
            }
        }
    }
    static void Main(string[] args) {
        Console.WriteLine("Fictional C/C++ Optimizing Command-line Compiler Version 103.33.0");
        DoFakeLinkErrors(DoFakeCompile_Assembly("mscorlib.dll"));
    }
}


2

批量

放置在包含大量文件的文件夹中。如果滚动速度足够快,那么没人会怀疑。

:l
dir/s
echo %RANDOM%
echo %RANDOM%
echo %RANDOM% 
goto l

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.