Skip to content

Instantly share code, notes, and snippets.

@dialektike
dialektike / rugarch_error.R
Created December 28, 2016 07:53
rugarch 설치 에러
> require(rugarch)
필요한 패키지를 로딩중입니다: rugarch
Error : .onLoad가 loadNamespace()에서 'rgl'때문에 실패했습니다:
호출: dyn.load(file, DLLpath = DLLpath, ...)
에러: 공유된 객체 '/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so'를 로드 할 수 없습니다:
dlopen(/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/libs/rgl.so
Reason: image not found
@dialektike
dialektike / Rguide.xml
Last active March 6, 2017 08:34
구글 R 스타일 가이드(Google's R Style Guide) 번역
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="styleguide.css"/>
<title>Google's R Style Guide</title>
</head>
<body>
@dialektike
dialektike / 2017_7_8_KBO.csv
Last active July 10, 2017 15:20
2017년 7월 8일 KBO 타격 순위
순위 선수명 팀명 AVG G PA AB R H 2B 3B HR TB RBI SAC SF
1 김선빈 KIA 0.38 79 303 271 49 103 23 0 2 132 47 2 4
2 최형우 KIA 0.37 80 359 289 66 107 23 3 20 196 76 0 4
3 나성범 NC 0.359 61 264 237 53 85 20 1 13 146 51 0 1
4 김태균 한화 0.353 61 268 232 34 82 13 0 10 125 57 0 4
5 서건창 넥센 0.353 78 347 303 52 107 17 2 4 140 49 0 3
6 이대호 롯데 0.351 79 333 302 44 106 7 0 16 161 60 0 0
7 이명기 KIA 0.351 70 318 285 46 100 13 4 4 133 46 10 2
8 김재환 두산 0.35 78 353 309 56 108 20 2 21 195 57 0 1
9 손아섭 롯데 0.334 81 376 326 62 109 20 3 8 159 40 1 1
@dialektike
dialektike / read_any.R
Last active July 13, 2017 06:12
r에서 한글문서 열때 인코딩 문제 해결 함수. 참고: http://philogrammer.com/2017-03-15/encoding/
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)
}
@dialektike
dialektike / read_any_ex.R
Created July 13, 2017 07:28
맥에서 read.any() 함수를 사용하기
> 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 / temp.ipynb
Last active July 21, 2017 08:24
유니코드 보기
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dialektike
dialektike / .gitignore
Created January 6, 2019 09:03
my .gitignore file for python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
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,
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
@dialektike
dialektike / linear_search.rs
Created June 18, 2021 14:30
linear search
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,