commit 8dde1a2d1561295fb428908e5c2fe27b583aa087
parent 943578f5d82c7ef5fa5fc532a8a45f2e7cf1497c
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Tue, 10 Mar 2015 20:42:33 +0100
Merge branch 'master' of a3nm.net:git/mybin
Diffstat:
3 files changed, 112 insertions(+), 1 deletion(-)
diff --git a/cgitaboutfilter.c b/cgitaboutfilter.c
@@ -0,0 +1,84 @@
+// by p4bl0 <http://pablo.rauzy.name/>, public domain
+
+#include <stdio.h>
+#include <string.h>
+
+void
+print_html_c (int c)
+{
+ switch (c) {
+ case '<':
+ fputs("<", stdout);
+ break;
+ case '>':
+ fputs(">", stdout);
+ break;
+ case '&':
+ fputs("&", stdout);
+ break;
+ case '"':
+ fputs(""", stdout);
+ break;
+ default:
+ putchar(c);
+ }
+}
+
+void
+print_html_s (char *s)
+{
+ while (*s) print_html_c(*s++);
+}
+
+int
+main (int argc, char *argv[])
+{
+ char c;
+ char urlflag, urlbuf[256];
+ char *ext = strrchr(argv[1], '.');
+
+ if (NULL == ext) { // plain text
+ fputs("<pre>\n", stdout);
+ urlflag = -1;
+ while (EOF != (c = getchar())) {
+ if (urlflag > -1) {
+ if ((0 == urlflag && 'h' == c) ||
+ (1 == urlflag && 't' == c) ||
+ (2 == urlflag && 't' == c) ||
+ (3 == urlflag && 'p' == c)) {
+ urlbuf[urlflag++] = c;
+ } else if (urlflag < 4) { // not an url
+ urlbuf[urlflag++] = c;
+ urlbuf[urlflag] = 0;
+ print_html_s(urlbuf);
+ urlflag = -1;
+ } else { // indeed an url
+ urlbuf[urlflag++] = c;
+ while ('>' != (c = getchar())) {
+ if ('\n' == c) {
+ fputs("BROKEN README\n</pre>", stdout);
+ return 1;
+ } else {
+ urlbuf[urlflag++] = c;
+ }
+ }
+ urlbuf[urlflag] = 0;
+ printf("<a href=\"%s\">%s</a>>", urlbuf, urlbuf);
+ urlflag = -1;
+ }
+ } else {
+ if ('<' == c) {
+ urlflag++;
+ }
+ print_html_c(c);
+ }
+ }
+ fputs("\n</pre>", stdout);
+ } else if (0 == strcmp(".html", ext)) { // html
+ while (EOF != (c = getchar())) {
+ putchar(c);
+ }
+ }
+
+ return 0;
+}
diff --git a/cgitemailfilter.c b/cgitemailfilter.c
@@ -0,0 +1,25 @@
+// by p4bl0 <http://pablo.rauzy.name/>, public domain
+
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+ char flag = 0, c;
+ while (EOF != (c = getchar())) {
+ switch (c) {
+ case '@':
+ fputs(" _at_ ", stdout);
+ flag = 1;
+ break;
+ case '.':
+ if (flag) {
+ fputs(" .dot. ", stdout);
+ break;
+ }
+ default:
+ putchar(c);
+ }
+ }
+ return 0;
+}
diff --git a/startup b/startup
@@ -9,6 +9,8 @@ nm-applet &
#~/bin_private/logkeys
rm ~/temp/terminals
~/bin/layout
-#~/bin/kiwix
+~/bin/kiwix
xsetroot -solid '#000000' &
+# when using compton
+hsetroot -solid '#000000' &