Here's a few things I tried to write output to a python subprocess pipe.
from subprocess import Popen, PIPE
p = Popen('less', stdin=PIPE)
for x in xrange(100):
p.communicate('Line number %d.\n' % x)| obj-m += tcp_svr_sample.o | |
| all: | |
| make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules | |
| clean: | |
| make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clea |
| function uuid() { | |
| var uuid = "", i, random; | |
| for (i = 0; i < 32; i++) { | |
| random = Math.random() * 16 | 0; | |
| if (i == 8 || i == 12 || i == 16 || i == 20) { | |
| uuid += "-" | |
| } | |
| uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16); | |
| } |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <fcntl.h> | |
| #include <err.h> | |
| #include <unistd.h> | |
| #include <sys/types.h> | |
| #include <sys/socket.h> |
| /* | |
| * An example using splice syscall which avoids copying to/from user space buffers to kernel space | |
| * and uses the pipe buffers allocated in kernel space as an intermediate to directly xfer from one file to another | |
| * | |
| * gcc -o splice splice.c -g | |
| */ | |
| #define _GNU_SOURCE | |
| #include <stdio.h> | |
| #include <string.h> |
| # Basics of Elliptic Curve Cryptography implementation on Python | |
| import collections | |
| def inv(n, q): | |
| """div on PN modulo a/b mod q as a * inv(b, q) mod q | |
| >>> assert n * inv(n, q) % q == 1 | |
| """ | |
| for i in range(q): | |
| if (n * i) % q == 1: |
Here's a few things I tried to write output to a python subprocess pipe.
from subprocess import Popen, PIPE
p = Popen('less', stdin=PIPE)
for x in xrange(100):
p.communicate('Line number %d.\n' % x)| /** | |
| * More info? | |
| * [email protected] | |
| * http://aspyct.org | |
| * | |
| * Hope it helps :) | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> |
| import binascii | |
| from Crypto.Cipher import AES | |
| from Crypto.Random.random import getrandbits | |
| from hashlib import md5 | |
| from schematics.types import StringType | |
| import struct | |
| class DecryptionException(Exception): | |
| pass |
| /* | |
| * A simple libpng example program | |
| * http://zarb.org/~gc/html/libpng.html | |
| * | |
| * Modified by Yoshimasa Niwa to make it much simpler | |
| * and support all defined color_type. | |
| * | |
| * To build, use the next instruction on OS X. | |
| * $ brew install libpng | |
| * $ clang -lz -lpng16 libpng_test.c |