Skip to content

Instantly share code, notes, and snippets.

View ssabii's full-sized avatar

Joseph 요셉 ssabii

View GitHub Profile
@ssabii
ssabii / SmoothVideoPlaylist.cs
Created December 11, 2020 11:38 — forked from radiatoryang/SmoothVideoPlaylist.cs
short Unity C# script example for smoothly cutting / playing a playllist of VideoClips, by using one VideoPlayer (activeCam) to play the video and another VideoPlayer (otherCam) to cue up the next video... MIT License.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class SmoothVideoPlaylist : MonoBehaviour {
// to smoothly cut between two videos, we need two VideoPlayers
// make sure you create two VideoPlayers and assign them in the Inspector
public VideoPlayer activeCam, otherCam;
@ssabii
ssabii / dijkstra.py
Last active September 28, 2020 15:41
다익스트라 알고리즘
import sys
import heapq
import math
def dijkstra(start, graphs, weights):
shortest_path = [ [ 0 for _ in range(len(graphs)) ] for _ in range(len(graphs)) ] # 최단 경로 그래프
shortest_vertices = [-1 for _ in range(len(graphs))] # 최단 경로 연결 정보 (-1로 초기화)
shortest_weights = [ math.inf for _ in range(len(graphs)) ] # 최단 경로 가중치 정보 (무한대 값으로 초기화)
visited = set() # 방문 정보
heap = [] # 최소 힙
@ssabii
ssabii / kruskal.py
Last active September 25, 2020 09:38
크루스칼 알고리즘
import sys
import heapq
# 분리 집합 클래스
class DisjointSet:
def __init__(self):
self.parent = None
# 분리 집합 합집합 연산
def unionset(set1, set2):
@ssabii
ssabii / prim.py
Last active September 25, 2020 10:28
프림 알고리즘
import sys
import heapq
def prim(start, graphs, weights):
mst_graphs = [ [ 0 for _ in range(len(graphs)) ] for _ in range(len(graphs)) ] # 최소 신장 트리
mst_vertices = [-1 for _ in range(len(graphs))] # 최소 신장 트리 연결 정보 (-1로 초기화)
mst_weights = [ sys.maxsize for _ in range(len(graphs)) ] # 최소 신장 트리 가중치 정보 (최대 값으로 초기화)
visited = set() # 방문 정보
heap = [] # 최소 힙
@ssabii
ssabii / bfs.py
Created September 21, 2020 10:49
그래프 BFS
from collections import deque
def bfs(vertex, graph):
visited = set()
queue = deque()
visited.add(vertex)
queue.append(vertex)
while len(queue) > 0:
@ssabii
ssabii / dfs.py
Last active September 21, 2020 10:46
그래프 DFS
def dfs(vertex, graph):
visited.add(vertex)
print(vertex + 1, end = '') # 출력용
for i, v in enumerate(graph[vertex]):
if v == 1 and i not in visited:
print(end=' -> ') # 출력용
dfs(i, graph)
@ssabii
ssabii / babel_qick_start.md
Created August 16, 2020 18:32 — forked from falsy/babel_qick_start.md
BABEL 설치 및 사용하기

BABEL Qick Start

맥OS에서 BABEL 설치 및 사용하기

NodeJs, npm 이 설치되어 있어야 합니다.

BABEL 설치

1. 우선 npm 버전을 최신으로 업데이트 합니다.

$ npm install -g npm
@ssabii
ssabii / InterfaceExample.cs
Created May 11, 2020 07:47
인터페이스 예제 코드
interface IFile
{
void Save(List<int> item);
}
// 점수를 텍스트 파일로 저장하는 클래스
class TextFile : IFile
{
public void Save(List<int> item)
{
@ssabii
ssabii / interface.cs
Last active May 11, 2020 07:49
인터페이스 문법
interface IInterfaceName
{
int PropertyName
{
get;
set;
}
void MethodName(int num);
}
@ssabii
ssabii / Student.cs
Created April 21, 2020 08:55
DLL 파일 생성용 샘플 클래스
namespace StudentLibrary
{
public class Student
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}