Last active
August 29, 2015 14:18
Revisions
-
albinoloverats revised this gist
Jun 30, 2015 . 1 changed file with 4 additions and 13 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,12 +17,9 @@ static void qr_print(QRcode *qr) return; LINE(2); printf("%s", BLOCK); for (int y = 0; y < qr->width; y += (printf("%s\n%s", BLOCK, BLOCK), 1)) for (int x = 0; x < qr->width; x++) printf("%s", qr->data[y * qr->width + x] & 0x01 ? " " : BLOCK); LINE(1); return; } @@ -34,22 +31,16 @@ int main(int argc, char **argv) if (argc > 1) { for (int i = 1; i < argc; i += (strcat(data, argv[i]), 1)) if (i > 1) strcat(data, " "); qr = QRcode_encodeString(data, 0, QR_ECLEVEL_L, QR_MODE_8, 1); } else qr = QRcode_encodeData(read(STDIN_FILENO, data, sizeof data), (unsigned char *)data, 0, QR_ECLEVEL_L); qr_print(qr); QRcode_free(qr); return EXIT_SUCCESS; } -
albinoloverats revised this gist
Jun 12, 2015 . 1 changed file with 0 additions and 54 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,13 +2,6 @@ * gcc -lqrencode -Wall -Wextra -std=c99 -O3 -o qrcurses qrcurses.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -59,51 +52,4 @@ int main(int argc, char **argv) QRcode_free(qr); return EXIT_SUCCESS; } -
albinoloverats revised this gist
Jun 12, 2015 . 1 changed file with 54 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,13 @@ * gcc -lqrencode -Wall -Wextra -std=c99 -O3 -o qrcurses qrcurses.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h>/* * gcc -lqrencode -Wall -Wextra -std=c99 -O3 -o qrcurses qrcurses.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -11,6 +18,53 @@ #define BLOCK "\x1b[47m \x1b[0m" #define LINE(z) for (int y = 0; y < qr->width + z; y++) printf("%s", BLOCK); printf("\n") static void qr_print(QRcode *qr) { if (!qr) return; LINE(2); printf("%s", BLOCK); for (int y = 0; y < qr->width; y++) { for (int x = 0; x < qr->width; x++) printf("%s", qr->data[y * qr->width + x] & 0x01 ? " " : BLOCK); printf("%s\n%s", BLOCK, BLOCK); } LINE(1); return; } int main(int argc, char **argv) { char data[7089] = { 0x0 }; QRcode *qr = NULL; if (argc > 1) { for (int i = 1; i < argc; i++) { if (i > 1) strcat(data, " "); strcat(data, argv[i]); } qr = QRcode_encodeString(data, 0, QR_ECLEVEL_L, QR_MODE_8, 1); } else { size_t len = read(STDIN_FILENO, data, sizeof data); qr = QRcode_encodeData(len, (unsigned char *)data, 0, QR_ECLEVEL_L); } qr_print(qr); QRcode_free(qr); return EXIT_SUCCESS; } #include <qrencode.h> #define BLOCK "\x1b[47m \x1b[0m" #define LINE(z) for (int y = 0; y < qr->width + z; y++) printf("%s", BLOCK); printf("\n") static void qr_print(QRcode *qr) { if (!qr) -
albinoloverats revised this gist
Apr 2, 2015 . 1 changed file with 1 addition and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -29,14 +29,11 @@ static void qr_print(QRcode *qr) int main(int argc, char **argv) { char data[7089] = { 0x0 }; QRcode *qr = NULL; if (argc > 1) { for (int i = 1; i < argc; i++) { if (i > 1) @@ -47,7 +44,7 @@ int main(int argc, char **argv) } else { size_t len = read(STDIN_FILENO, data, sizeof data); qr = QRcode_encodeData(len, (unsigned char *)data, 0, QR_ECLEVEL_L); } -
albinoloverats created this gist
Apr 1, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ /* * gcc -lqrencode -Wall -Wextra -std=c99 -O3 -o qrcurses qrcurses.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <qrencode.h> #define BLOCK "\x1b[47m \x1b[0m" #define LINE(z) for (int y = 0; y < qr->width + z; y++) printf("%s", BLOCK); printf("\n") static void qr_print(QRcode *qr) { if (!qr) return; LINE(2); printf("%s", BLOCK); for (int y = 0; y < qr->width; y++) { for (int x = 0; x < qr->width; x++) printf("%s", qr->data[y * qr->width + x] & 0x01 ? " " : BLOCK); printf("%s\n%s", BLOCK, BLOCK); } LINE(1); return; } int main(int argc, char **argv) { size_t len = 0; char data[7089] = { 0x0 }; QRcode *qr = NULL; if (argc > 1) { for (int i = 1; i < argc; i++) len += strlen(argv[i]) + 1; for (int i = 1; i < argc; i++) { if (i > 1) strcat(data, " "); strcat(data, argv[i]); } qr = QRcode_encodeString(data, 0, QR_ECLEVEL_L, QR_MODE_8, 1); } else { len = read(STDIN_FILENO, data, sizeof data); qr = QRcode_encodeData(len, (unsigned char *)data, 0, QR_ECLEVEL_L); } qr_print(qr); QRcode_free(qr); return EXIT_SUCCESS; }