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
Uses `evince` as PDF viewer (gnome in linux), you will need to change it for mac. | |
# 1. Install Python dependencies: | |
pip install: | |
* PyPDF2 | |
* pandas | |
# 2. Generate the CSV of PDF files and their page counts. |
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 | |
import os | |
import typing | |
from pathlib import Path | |
_default_annotation_likelihood_threshold = 0.9 | |
def main(): | |
parser = argparse.ArgumentParser( |
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
(lp) ksikka@DESKTOP-KF26FAO:~/lightning-pose$ time python scripts/train_hydra.py | |
[2024-10-07 16:56:08,660][HYDRA] /home/ksikka/miniconda3/envs/lp/lib/python3.10/site-packages/hydra/_internal/hydra.py:119: UserWarning: Future Hydra versions will no longer change working directory at job runtime by default. | |
See https://hydra.cc/docs/1.2/upgrades/1.1_to_1.2/changes_to_job_working_dir/ for more information. | |
ret = run_job( | |
Our Hydra config file: | |
-------------------- | |
data parameters | |
-------------------- | |
image_resize_dims: {'width': 256, 'height': 256} |
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
// This is NOT recursive dfs, but the answer should be the same. | |
// Use it to test if your code is working, by comparing our function's output with | |
// this function's output. | |
func dfsReferenceImplementation(at: Node, to: Node) -> [Node] { | |
var y: [Int: Node] = [Int: Node]() | |
var x: [(Node, Node)] = [] | |
x.append((at, at)) | |
while x.count > 0 { | |
let (n1, n2) = x.removeFirst() | |
y[n1.id] = n2 |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Graph builder</title> | |
<style> | |
.arena { | |
position: relative; | |
} |
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
// | |
// Try running in http://online.swiftplayground.run/ | |
// | |
import Foundation | |
// Given a Person class (struct is like class with some differences you can read about). | |
struct Person: Equatable { | |
var id: Int | |
var favoriteColor: String |
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
// soln 1: scan from left to right, and keep track of whether or not it's xybalanced so far | |
public boolean xyBalance(String str) { | |
boolean isXyBalanced = true; | |
for (int i = 0; i < str.length(); i++) { | |
if (str.charAt(i) == 'x') isXyBalanced = false; | |
if (str.charAt(i) == 'y') isXyBalanced = true; | |
} | |
return isXyBalanced; | |
} |
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
function parseHistoryDate(rawString) { | |
var dtstr = rawString.replace('HST','UTC-1000').replace('HDT','UTC-900').replace('AST',"UTC-400"); | |
const dt = new Date(dtstr); | |
if (!isFinite(dt)) throw new Error('assertion error'); | |
var m; | |
var tzoffsets = { | |
'AST': -4, | |
'EST': -5, |
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
func parseNodesPhase1(_ rawNodes: [[Double]]) -> [Node] { | |
var nodes: [Node] = [] | |
for rn in rawNodes { | |
nodes.append(Node(id: Int(rn[0]), x: rn[1], y:rn[2])) | |
} | |
return nodes | |
} |
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
class Node { | |
let id: Int | |
let x: Double | |
let y: Double | |
var neighbors: [Node] = [] | |
init(id: Int, x: Double, y: Double) { | |
self.id = id | |
self.x = x | |
self.y = y |
NewerOlder