Skip to content

Instantly share code, notes, and snippets.

View goddoe's full-sized avatar

Sungju Kim goddoe

View GitHub Profile
@goddoe
goddoe / gist:cafb25b524cec80d0b183e806cb14fef
Created May 14, 2022 13:48
vue3. add class after mount
<script setup>
import { RouterLink, RouterView } from "vue-router";
import { onMounted } from 'vue';
onMounted(() => {
// document.getElementById("app").classList.add('col-lg-8', 'mx-auto', 'p-3', 'py-md-5')
})
</script>
@goddoe
goddoe / FInd PYTHON_INCLUDE.bash
Created May 13, 2022 07:54
FInd PYTHON_INCLUDE
python -c "from sysconfig import get_paths as gp; print(gp()['include'])"
@goddoe
goddoe / How do I pass a parameter to a python Hadoop streaming job.txt
Created May 11, 2022 15:38
How do I pass a parameter to a python Hadoop streaming job?
Reference: https://stackoverflow.com/questions/9509063/how-do-i-pass-a-parameter-to-a-python-hadoop-streaming-job
# method 1.
In your Python code,
import os
(...)
os.environ["PARAM_OPT"]
In your Hapdoop command include:
@goddoe
goddoe / fix nerd tree not opening dir bug.txt
Created May 11, 2022 05:29
fix nerd tree not opening dir bug.txt
Reference: https://stackoverflow.com/questions/8753286/nerd-tree-enter-does-not-open-sub-dirs
Putting this in my .vimrc solved the problem: let g:NERDTreeDirArrows=0
The creator gave me the fix: https://github.com/scrooloose/nerdtree/issues/108
@goddoe
goddoe / install mecab.txt
Last active May 4, 2022 05:36
install mecab
안녕하세요.
아래와 같이 Mecap 설치를 완료하였습니다.
직접 import하여 객체 생성을 하려고 하는데 제목과 같은 Error가 발생하네요.
Reference: https://github.com/konlpy/konlpy/issues/182
Mebcap 설치 완료.
wget https://bitbucket.org/eunjeon/mecab-ko/downloads/mecab-0.996-ko-0.9.2.tar.gz
tar -zxvf mecab--ko-.tar.gz
cd mecab--ko-
@goddoe
goddoe / map per file.sh
Created April 29, 2022 06:19
map per file.sh
# Reference: https://www.ghostar.org/2013/09/mass-gzip-files-inside-hdfs-using-the-power-of-hadoop/
Once that’s done, we want to run the hadoop streaming job. I ran it like this. There’s a lot of output here. I include it only for reference.
$ hadoop jar /usr/lib/hadoop-0.20/contrib/streaming/hadoop-streaming-*.jar
-Dmapred.reduce.tasks=0 -mapper gzipit.sh
-input ./gzipped.txt
-output /user/hcoyote/gzipped.log
-verbose
-inputformat org.apache.hadoop.mapred.lib.NLineInputFormat
-file gzipit.sh
@goddoe
goddoe / bash for loop.sh
Created April 12, 2022 14:47
bash for loop
#Reference: https://blog.leocat.kr/notes/2018/02/17/shell-looping-list
$ cat test.sh
#!/bin/bash
for NAME in "ME" "YOU" "THEM" "ALL"; do
echo "Name is ${NAME}"
done
PLANETS=( "EARTH" "MARS" "VINUS" )
@goddoe
goddoe / html_parser.py
Created January 20, 2022 03:24
html parser example
from html.parser import HTMLParser
class StripQuery(HTMLParser):
def __init__(self):
super(StripQuery, self).__init__()
self.query = ""
def handle_starttag(self, tag, attrs):
pass
@goddoe
goddoe / slack_push.py
Created January 12, 2022 16:00
slack_push.py
import requests
def push(channel, message, nickname=None):
print(f"Sending message to {channel}: {message}")
url = 'http://abc.company.com/notice' # or /privmsg
headers = {
'X-SENDER': 'slack'
}
import inspect
class A:
def __init__(self, a,b,c):
args, _, _, values = inspect.getargvalues(inspect.currentframe())
values.pop("self")
for key, val in values.items():
setattr(self, key, val)