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
| #include <vector> | |
| int main() { | |
| //char cdat[] = "12345678"; | |
| char cdat[] = "59791911701697178620772166487621926539855976237879300869872931303532122404711706813176657053802481833015214226705058704017099411284046473395211022546662450403964137283487707691563442026697656820695854453826690487611172860358286255850668069507687936410599520475680695180527327076479119764897119494161366645257480353063266653306023935874821274026377407051958316291995144593624792755553923648392169597897222058613725620920233283869036501950753970029182181770358827133737490530431859833065926816798051237510954742209939957376506364926219879150524606056996572743773912030397695613203835011524677640044237824961662635530619875905369208905866913334027160178"; | |
| //char cdat[] = "03036732577212944063491565474664"; | |
| int N = strlen(cdat)*10000; | |
| int *dat = new int[N]; | |
| int *cc = new int[N+1]; | |
| for (int j = 0; j < N; j+=strlen(cdat)) { |
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
| d4::pa_ax3 |- = x + x 0 | |
| d5::ax-1 |- implies | |
| = x + x 0 | |
| implies = y + y 0 = x + x 0 | |
| d3:d4,d5:ax-mp |- implies = y + y 0 = x + x 0 | |
| 3:d3:alpha_2 |- implies = y + y 0 forall x = x + x 0 | |
| d6::pa_ax3 |- = y + y 0 | |
| 5:d6,3:ax-mp |- forall x = x + x 0 |
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
| #!/bin/bash -e | |
| curl -O https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg | |
| hdiutil attach googlechrome.dmg | |
| SRC=/Volumes/Google\ Chrome/Google\ Chrome.app/Contents/Frameworks/Google\ Chrome\ Framework.framework/Libraries/WidevineCdm | |
| DEST=/Applications/Chromium.app/Contents/Frameworks/Chromium\ Framework.framework/Libraries/ | |
| cp -R "$SRC" "$DEST" | |
| hdiutil detach /Volumes/Google\ Chrome/ |
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
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| import argparse | |
| import zmq | |
| import json | |
| import cv2 | |
| import numpy as np | |
| from hexdump import hexdump | |
| import scipy.misc |
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
| # homogenous line from two points (this isn't on the internet...) | |
| line = [0,0,0] | |
| line[0] = (f1[1] - f2[1]) * (f1[1] * f2[0] - f1[0] * f2[1]) | |
| line[1] = (f1[0] - f2[0]) * (f1[0] * f2[1] - f1[1] * f2[0]) | |
| line[2] = (f1[0] * f2[1] - f1[1] * f2[0]) * (f1[1] * f2[0] - f1[0] * f2[1]) | |
| line = np.array(line) | |
| # line intersection (https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection#Using_homogeneous_coordinates) | |
| p = np.array([l1[1] * l2[2] - l2[1] * l1[2], l2[0] * l1[2] - l1[0] * l2[2], l1[0] * l2[1] - l2[0] * l1[1]]) | |
| p /= p[2] |
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
| real_colors = [[115,82,68],[194,150,130],[98,122,157],[87,108,67],[133,128,177],[103,189,170],[214,126,44],[80,91,166],[193,90,99],[94,60,108],[157,188,64],[224,163,46],[56,61,150],[70,148,73],[175,54,60],[231,199,31],[187,86,149],[8,133,161],[243,243,242],[200,200,200],[160,160,160],[122,122,121],[85,85,85],[52,52,52]] |
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
| def getFundamentalMatrix(pts1, pts2): | |
| vvec = [] | |
| for p1, p2 in zip(pts1, pts2): | |
| vvec.append([p2[0] * p1[0], p2[0] * p1[1], p2[0], p2[1] * p1[0], p2[1] * p1[1], p2[1], p1[0], p1[1], 1]) | |
| vvec = np.array(vvec) | |
| U, S, Vt = np.linalg.svd(vvec) | |
| Fvl = Vt[-1] | |
| om = Fvl.reshape(3,3) |
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
| def ransac_polyfit(x, y, order=3, n=20, k=100, t=0.1, d=100, f=0.8): | |
| # Thanks https://en.wikipedia.org/wiki/Random_sample_consensus | |
| # n – minimum number of data points required to fit the model | |
| # k – maximum number of iterations allowed in the algorithm | |
| # t – threshold value to determine when a data point fits a model | |
| # d – number of close data points required to assert that a model fits well to data | |
| # f – fraction of close data points required | |
| besterr = np.inf |
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 cv2 | |
| import numpy as np | |
| from tqdm import tqdm | |
| def test_frame_gen(limit=None): | |
| fq = [] | |
| cap = cv2.VideoCapture("data/test.mp4") | |
| cnt = 0 | |
| while 1: | |
| ret, frame = cap.read() |
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
| #!/usr/bin/env python | |
| def msg(x): | |
| print "S:",x.encode("hex") | |
| if len(x) <= 7: | |
| ret = chr(len(x)) + x | |
| else: | |
| assert False | |
| return ret.ljust(8, "\x00") | |
| def isotp_send(panda, x, addr, bus=0): |