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 partition(n): | |
# x: current coin, y: remain value | |
def helper(x, y): | |
if y <= 0: | |
return int(y == 0) | |
# use x and not use x | |
z = helper(x, y-x) | |
if x < y: | |
z += helper(x+1, y) | |
return z |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
n = 25 | |
q = n * n | |
A = np.eye(q) |
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 argparse | |
p = argparse.ArgumentParser(description='off to obj.') | |
p.add_argument('input') | |
p.add_argument('out') | |
args = p.parse_args() | |
with open(args.input) as f: | |
lines = f.readlines() | |
meta = lines[1].split() |
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
from __future__ import print_function | |
import sys | |
if(len(sys.argv) != 3): | |
print('Usage: ', sys.argv[0], 'input.obj output.vtk') | |
sys.exit() | |
import vtk | |
reader = vtk.vtkOBJReader() | |
reader.SetFileName(sys.argv[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
import numpy as np | |
import cv2 | |
cap = cv2.VideoCapture('rtmp://localhost/live/stream') | |
while(True): | |
# Capture frame-by-frame | |
ret, frame = cap.read() | |
# Our operations on the frame come here |
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
using System; | |
using System.Net; | |
using System.Text; | |
using System.Threading; | |
namespace SimpleHttp | |
{ | |
// reference: https://www.codehosting.net/blog/BlogEngine/post/Simple-C-Web-Server | |
class SimpleHttpServer | |
{ |
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 <stdio.h> | |
#include <pthread.h> | |
void *busy(void *ptr) { | |
puts("hello"); | |
return NULL; | |
} | |
int main() { | |
pthread_t id; | |
pthread_create(&id, NULL, busy, "hi"); | |
while (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
import numpy as np | |
import cv2 | |
cap = cv2.VideoCapture('rtmp://localhost/live/stream') | |
while(True): | |
# Capture frame-by-frame | |
ret, frame = cap.read() | |
# Our operations on the frame come here |
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 threading | |
import time | |
def test(x): | |
def task(): | |
while 1: | |
print(x) | |
time.sleep(x) | |
y = threading.Thread(target=task) |
NewerOlder