Created
September 26, 2020 13:10
-
-
Save jamestomasino/ce03cc329f881488a7debe914d507a07 to your computer and use it in GitHub Desktop.
Tomasino.is homepage
This file contains hidden or 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
<?php | |
$article = ""; | |
$path = explode('/', $_SERVER['REQUEST_URI'])[1]; | |
$path2 = explode('/', $_SERVER['REQUEST_URI'])[2]; | |
if (! $path) { | |
$path = shell_exec("shuf -n1 /usr/share/dictd/gcide.index | cut -f1 "); | |
} | |
if (($path === "a") || ($path === "an") || ($path === "the")) { | |
if (isset($path2)) { | |
$article = $path . " "; | |
$path = $path2; | |
} | |
} | |
?> | |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv=X-UA-Compatible content="IE=edge"> | |
<meta name=viewport content="shrink-to-fit=no,width=device-width,height=device-height,initial-scale=1,user-scalable=1"> | |
<meta name="description" content="A collection of places to find me around the web"> | |
<title>tomasino is <?php echo $article ?>... <?php echo $path ?></title> | |
<style> | |
h1,pre{margin:0;padding:0;border:0;font:inherit;vertical-align:baseline} | |
body{font-family:"Consolas",monospace;font-size:18px;background:#303030;color:#c1c1c1;} | |
h1{line-height:100%;font-size:2.4em;margin-top:2rem;margin-bottom:2rem;color:#03fcfc;} | |
pre{margin-bottom:.75rem;font-size:0.7rem;line-height:1.2rem;letter-spacing:-0.09em;} | |
@media screen and (min-width: 600px) { | |
pre{font-size:1rem;line-height:1.4rem;letter-spacing:0em;} | |
} | |
@media screen and (min-width: 900px) { | |
pre{font-size:1.4rem;line-height:2rem;} | |
} | |
</style> | |
</head> | |
<body> | |
<h1>Tomasino is <?php echo $article ?>...</h1> | |
<pre> | |
<?php | |
system("dict -d gcide \"$path\" | tail -n+5 | sed -n '/definition found/q;p' | sed -n '/From The.*Dictionary/q;p'"); | |
?> | |
</pre> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment