Skip to content

Instantly share code, notes, and snippets.

@dialektike
dialektike / ch12-00-an-io-project.md
Created Aug 21, 2021
12 장 I/O 프로젝트: 명령줄(Command Line) 프로그램 작성하기
View ch12-00-an-io-project.md

I/O 프로젝트: 명령줄(Command Line) 프로그램 작성하기

명령줄 인수들(Arguments) 처리하기

프로젝트 생성합니다. 그리고 프로젝트 폴더로 이동합니다.

cargo new minigrep
cd minigrep
@dialektike
dialektike / Writing_Automated_Tests.md
Created Aug 7, 2021
자동화된 테스트 작정하기(Writing Automated Tests)
View Writing_Automated_Tests.md

자동화된 테스트 작정하기(Writing Automated Tests)

테스트를 작정하는 방법

#[derive(Debug)]
struct Rectangle {
    width: u32,
    height: u32,
}
View merge_sort.py
test = [8,2,4,6,9,7,10,1,5,3]
def merge(left,right):
sort = []
i = 0
j = 0
left_size = len(left)
right_size = len(right)
while left_size > i and right_size > j:
if left[i] > right[j]:
View linear_search.rs
use std::time::Instant;
fn main() {
println!("Hello, world!");
let unsort: [i32; 100] = [
49, 76, 80, 74, 18, 16, 5, 71, 65, 6, 3, 12, 36, 75, 22, 19, 93, 97, 43, 85, 7, 10, 67, 69,
79, 51, 31, 60, 20, 50, 82, 44, 59, 33, 95, 98, 72, 90, 57, 39, 17, 94, 42, 77, 96, 68, 56,
66, 81, 86, 48, 88, 87, 38, 78, 73, 11, 84, 8, 14, 58, 37, 9, 25, 47, 28, 27, 83, 63, 100,
91, 4, 13, 40, 15, 32, 62, 54, 64, 35, 99, 53, 34, 30, 26, 29, 89, 2, 23, 55, 92, 1, 46,
View num_100000.csv
We can't make this file beautiful and searchable because it's too large.
62156,73959,24691,75536,58695,15494,64003,77153,89675,76307,2378,12926,64370,8822,90762,60741,5610,3574,13244,60114,10512,7804,55316,10105,25489,49002,74117,91312,6436,10111,72502,31935,88785,68148,43350,99569,7935,65384,65052,23131,81759,19241,86372,43240,11619,9682,58602,95206,63380,91799,34305,91770,78074,8219,19915,90187,11542,41395,7574,80052,89088,79275,79353,41237,38963,7276,16678,89511,29624,21342,76344,63368,8755,65336,17913,90936,53989,34468,56195,41040,81402,71689,49495,3951,4200,60067,34503,26725,38974,43359,29296,16769,68523,26278,67418,46365,90253,43313,55781,79793,91993,22052,19351,58978,92307,86819,95160,27257,40784,93009,45722,93753,70391,29053,90545,80750,22917,97508,80592,29793,19340,86473,70451,18612,14049,72022,57675,17595,66432,26482,95407,61164,94243,15513,17117,80594,98421,9485,72615,79951,21102,23479,10113,88367,88945,21453,74032,988,88961,62314,41396,97450,57855,6467,23932,45621,73090,73418,93904,16178,62194,98523,58077,68550,10274,57438,22292,40411,34168,88153,93820,4670,37731,99717
View num_1000.txt
177,716,976,741,842,231,487,115,658,784,5,327,193,134,515,268,108,676,353,856,587,790,531,967,330,171,638,19,882,135,630,974,650,195,325,968,307,501,490,76,248,112,334,159,502,532,562,958,299,474,760,44,187,373,722,289,272,893,636,647,20,977,889,423,913,874,300,946,389,933,970,208,275,214,176,189,292,972,86,633,895,678,822,191,494,721,370,564,331,342,72,241,462,712,46,677,713,767,872,649,540,163,603,244,863,707,809,6,356,621,232,719,355,811,466,212,765,781,234,80,629,890,31,844,66,376,270,663,849,513,959,634,40,335,250,675,27,635,459,8,75,213,687,278,819,435,801,406,180,618,744,600,963,908,201,538,427,254,505,273,277,805,51,280,59,665,984,25,294,392,262,240,937,527,923,568,397,563,378,463,627,867,996,943,990,997,417,983,816,881,22,506,768,9,343,405,104,839,865,61,711,957,101,62,759,351,63,624,787,385,552,7,919,170,345,285,456,141,305,15,485,476,720,669,548,814,543,610,147,374,174,576,139,921,852,743,666,569,796,265,381,825,433,188,387,932,688,228,136,384,778,878,97,601,586,186,566,457,773,661,766,897,498,106,
@dialektike
dialektike / .gitignore
Created Jan 6, 2019
my .gitignore file for python
View .gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
@dialektike
dialektike / temp.ipynb
Last active Jul 21, 2017
유니코드 보기
View temp.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dialektike
dialektike / read_any_ex.R
Created Jul 13, 2017
맥에서 read.any() 함수를 사용하기
View read_any_ex.R
> temp_kbo <- read.csv("2017_7_8_KBO_win.csv", header = TRUE)
Error in make.names(col.names, unique = TRUE) :
'<bc><f8><c0><a7>'에서 유효하지 않은 멀티바이트 문자열이 있습니다
> library(readr)
> read.any <- function(text, sep = "", ...) {
+ encoding <- as.character(guess_encoding(text)[1,1])
+ setting <- as.character(tools::file_ext(text))
+ if(sep != "" | !(setting %in% c("csv", "txt")) ) setting <- "custom"
+ separate <- list(csv = ",", txt = "\n", custom = sep)
+ result <- read.table(text, sep = separate[[setting]], fileEncoding = encoding, ...)
@dialektike
dialektike / read_any.R
Last active Jul 13, 2017
r에서 한글문서 열때 인코딩 문제 해결 함수. 참고: http://philogrammer.com/2017-03-15/encoding/
View read_any.R
library(readr)
read.any <- function(text, sep = "", ...) {
encoding <- as.character(guess_encoding(text)[1,1])
setting <- as.character(tools::file_ext(text))
if(sep != "" | !(setting %in% c("csv", "txt")) ) setting <- "custom"
separate <- list(csv = ",", txt = "\n", custom = sep)
result <- read.table(text, sep = separate[[setting]], fileEncoding = encoding, ...)
return(result)
}