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
import subprocess | |
def scatter_plot(x, y, title="line1", width=80, height=25): | |
gnuplot = subprocess.Popen(["/usr/bin/gnuplot"], | |
stdin=subprocess.PIPE) | |
gnuplot.stdin.write(("set term dumb %d %d\n"%(width, height)).encode('utf-8')) | |
gnuplot.stdin.write(("plot '-' using 1:2 title '%s' with linespoints \n" % (title)).encode('utf-8')) | |
for i,j in zip(x,y): | |
gnuplot.stdin.write(("%f %f\n" % (i,j)).encode('utf-8')) | |
gnuplot.stdin.write("e\n".encode('utf-8')) | |
gnuplot.stdin.flush() |
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
import subprocess | |
def get_terminal_size(): | |
import os | |
env = os.environ | |
def ioctl_GWINSZ(fd): | |
try: | |
import fcntl, termios, struct, os | |
cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ, |
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
STOCKS=$(shell cat portfolio.txt) | |
ALGODIR=algos | |
PERFDIR=perf | |
ALGOS=$(wildcard $(ALGODIR)/*.py) | |
PERFS=$(patsubst $(ALGODIR)/%.py,$(PERFDIR)/%.perf,$(ALGOS)) | |
CAPITAL=1000 | |
START_DATE=2011-1-1 | |
END_DATE=2012-1-1 |
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
// gcc brailleplot.c -o brailleplot | |
// python -c "print('\n'.join(['{} {}'.format(i, i**2) for i in range(-20, 20)]))" |./brailleplot 30 30 | |
#include <locale.h> | |
#include <wchar.h> | |
#include <stdlib.h> | |
wchar_t to_braille(unsigned char byte) { | |
return 10240 + ( | |
((byte >> 7) & (1 << 0)) | | |
((byte >> 3) & (1 << 3)) | |