Skip to content

Instantly share code, notes, and snippets.

View 201411108's full-sized avatar
๐Ÿ’ป
working

Handong Kim 201411108

๐Ÿ’ป
working
View GitHub Profile
@201411108
201411108 / reversal_list.py
Created August 14, 2021 12:42
numpy ์—†์ด ์ด์ค‘๋ฐฐ์—ด ํ–‰์—ด ๋ฐ˜์ „ํ•˜๊ธฐ
# target_list : [][]
list(map(list, zip(*target_list)))
@201411108
201411108 / undirected_graph_input.py
Last active July 27, 2021 01:52
in acmicpc, undirected graph input methods
import sys
n, m, v = list(map(int, sys.stdin.readline().split())) # N๊ฐœ์˜ ์ •์ , M๊ฐœ์˜ ๊ฐ„์„ , ์‹œ์ž‘ ๋…ธ๋“œ V
graph = [[] for _ in range(n + 1)] # n + 1์ธ ์ด์œ  -> ํŽธ์˜์ƒ, ๋ฌธ์ œ์— ์ฃผ์–ด์ง€๋Š” ๊ฐ’ ๊ทธ๋Œ€๋กœ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด
"""dictionary ์‚ฌ์šฉ ์‹œ
graph = collections.defaultdict(list) # ๋‹จ ์ด ๊ฒฝ์šฐ, ๋…ธ๋“œ๋ฅผ ์กฐํšŒํ•  ๋•Œ list(graph) ํ˜•ํƒœ๋กœ ํ•ด์ค˜์•ผ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋Š”๋‹ค.
"""
# ์–‘๋ฐฉํ–ฅ ๊ทธ๋ž˜ํ”„ ์ผ ๊ฒฝ์šฐ
for _ in range(m):
@201411108
201411108 / bfs_queue.py
Created July 11, 2021 04:43
BFS(queue)_python
def bfs(start_v):
discovered = [start_v]
queue = deque()
queue.append(start_v)
while queue:
v = queue.popleft()
for w in graph[v]:
if w not in discovered:
discovered.append(w)
queue.append(w)
@201411108
201411108 / dfs_stack.py
Last active July 18, 2021 05:56
DFS(stack)_python
def iterative_dfs(start_v):
discovered = []
stack = [start_v]
while stack:
v = stack.pop()
if v not in discovered:
discovered.append(v)
for w in graph[v]:
stack.append(w)
@201411108
201411108 / dfs_recurvise.py
Last active July 11, 2021 04:40
DFS(recursive)_python
def recursive_dfs(v, discovered=[]):
discovered.append(v)
for w in graph[v]:
if w not in discovered:
discovered = recursive_diff(w, discovered)
return discovered
# adjacency list
graph = {
1: [2, 3, 4],
@201411108
201411108 / fix_exfat_drive.md
Created April 28, 2020 06:32 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?