Skip to content

Commit 1b38ba1

Browse files
committed
Add top langs not to use
1 parent 9172c4c commit 1b38ba1

File tree

7 files changed

+234
-0
lines changed

7 files changed

+234
-0
lines changed

top-langs-not-to-use/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
create-virus:
2+
@php src/encoder.php "src/original.php" "src/virus_code.ws"
3+
@echo "🦠 Done!"
4+
5+
execute-virus:
6+
@php src/decoder.php "src/output.php"

top-langs-not-to-use/composer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"repositories": [
3+
{
4+
"type": "package",
5+
"package": {
6+
"name": "igorw/whitespace-php",
7+
"version": "1.0.1",
8+
"source": {
9+
"url": "https://github.com/igorw/whitespace-php",
10+
"type": "git",
11+
"reference": "master"
12+
},
13+
"autoload": {
14+
"files": ["src/whitespace.php"]
15+
}
16+
}
17+
}
18+
],
19+
"require": {
20+
"igorw/whitespace-php": "^1.0"
21+
}
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
use igorw\whitespace as w;
6+
7+
$outputFile = __DIR__ . '/output.php';
8+
9+
$outputFileContents = file_get_contents($outputFile);
10+
11+
if (preg_match('/\s+$/', $outputFileContents, $matches)) {
12+
$whitespace = substr($matches[0], 1);
13+
14+
system("stty -icanon");
15+
w\evaluate(w\parse(str_split($whitespace)));
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
require_once __DIR__ . '/../vendor/autoload.php';
4+
5+
$originalFileContents = file_get_contents($argv[1]);
6+
$hiddenFileContents = file_get_contents($argv[2]);
7+
8+
// cleanup trailing whitespaces
9+
$originalFileContents = preg_replace('/\s*$/', '', $originalFileContents);
10+
11+
$output = <<<CODE
12+
$originalFileContents
13+
$hiddenFileContents
14+
CODE;
15+
16+
file_put_contents(__DIR__ . '/output.php', $output);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
function fibonacci($n) {
4+
if ($n < 2) {
5+
return $n;
6+
}
7+
8+
return fibonacci($n - 2) + fibonacci($n - 1);
9+
}
10+
echo fibonacci(10)."\n";
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
17+
18+
19+
20+
21+
22+
23+
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
51+
52+
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
68+
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+
80+
81+
82+
83+
84+
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
95+
96+
97+
98+
99+
100+
101+
102+
103+
104+
105+
106+
107+
108+
109+
110+

0 commit comments

Comments
 (0)