This file contains 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 time | |
import sys | |
sys.path.append('/Users/tjw/anaconda3/envs/py35/lib/python3.5/site-packages') | |
from ipykernel.kernelapp import IPKernelApp | |
from tornado import ioloop | |
from bpy.app.handlers import persistent, scene_update_pre | |
class StepIPKernelApp(IPKernelApp): |
This file contains 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
def H2str(h): | |
return chr(h&0xff)+chr(h>>8) | |
f=open("aaa.gif", "wb") | |
f.write("GIF89a") | |
f.write("\x00\x01\x00\x01") | |
f.write("\xF7\x01\x00") #GCT | |
f.write("\xff\x00\xff") | |
f.write("\xff\xff\x00") | |
f.write("\n=1") | |
f.write("\r\n\x00") |
This file contains 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 csv | |
dot = lambda a,b: sum(i*j for i,j in zip(a,b)) | |
mean = lambda a: sum(a)/len(a) | |
rows = list(csv.DictReader(open("insurance.csv"))) | |
data= {k: [float(i[k]) for i in rows] for k in rows[0]} | |
x, y = data['X'], data['Y'] | |
n = len(x) | |
beta1 = (n*dot(x,y)-sum(x)*sum(y))/(n*dot(x,x)-sum(x)**2) | |
beta0 = mean(y)-beta1*mean(x) | |
print("beta0 = ",beta0,",beta1 = ",beta1) |
This file contains 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
#include <iostream> | |
#include <map> | |
#include <fstream> | |
int main(int argc, char **argv) { | |
std::map<int,unsigned char> cells; | |
std::ifstream is(argv[1], std::ifstream::binary); | |
auto loop = [&](int s, char x, char y, int cnt=0) -> bool { | |
while(cnt >= 0 && is.seekg(s, is.cur)) | |
[&](int d){cnt += (d == x) - (d == y);}(is.get()); | |
}; |
This file has been truncated, but you can view the full file.
This file contains 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
{ | |
"metadata": { | |
"name": "" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
This file contains 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
package main | |
import ( | |
"fmt" | |
"go/ast" | |
"go/parser" | |
"go/token" | |
"math/big" | |
"reflect" | |
"strings" |