Skip to content

Instantly share code, notes, and snippets.

View priancho's full-sized avatar

Han-Cheol Cho priancho

View GitHub Profile
@priancho
priancho / bashrc
Last active April 23, 2024 08:21
.bashrc
# .bashrc
# source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# set DBUS for ssh connection
eval `dbus-launch --auto-syntax`
@priancho
priancho / flume.conf
Last active October 30, 2015 06:26
flume.conf with a custome twitter source (for userstream), file channel and hdfs sink
agent.sources = s1
agent.sinks = k1
agent.channels = c1
# Flume proxy option needs the FLUME-2618 patch
agent.sources.s1.http.proxyHost=<http proxy ip address>
agent.sources.s1.http.proxyPort=<http proxy port>
# To use TwitterUserStreamToJSONSource, check the following java program.
# https://github.com/priancho/flume/blob/trunk/flume-ng-sources/flume-twitter-source/src/main/java/org/apache/flume/source/twitter/TwitterUserStreamToJSONSource.java
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
#
#
# log shortener for Hadoop logs
#
# History:
# 2015/12/04,hancheol.cho - Simple rule-based (1:1) log shortening algorithm
#
@priancho
priancho / gist:b04f8fbe7e1f84cbccac
Last active January 25, 2016 08:21
tweet text filtering and normalization for NEologd
#!/usr/local/bin/ruby
# -*- coding: utf-8 -*-
require 'cgi'
require 'nkf'
def normalize_text(t)
# Decode HTML tags in Tweet
# > http://www.xmisao.com/2014/03/09/how-to-encode-decode-html-entities-in-ruby.html
###########################
### Reference Web-pages ###
###########################
#
# Best reference:
# https://gist.github.com/MohamedAlaa/2961058
# http://lukaszwrobel.pl/blog/tmux-tutorial-split-terminal-windows-easily
# https://gist.github.com/spicycode/1229612
#
# Pre-requisites:
@priancho
priancho / .vimrc
Last active March 26, 2019 10:39
.vimrc
" Install Vim > 7.4.1578+ for YouCompleteMe
" $ sudo curl -L https://copr.fedorainfracloud.org/coprs/mcepl/vim8/repo/epel-7/mcepl-vim8-epel-7.repo -o /etc/yum.repos.d/mcepl-vim8-epel-7.repo
" $ sudo yum update vim*
" Install from source if you use CentOS 6.x
" $ git clone https://github.com/vim/vim.git
" $ cd vim
" $ ./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp
" $ make; sudo make install
"
" Install Python 2.7 or > 3.4 for YouCompleteMe
@priancho
priancho / pprint_utf8.py
Created April 25, 2017 02:30
python 2.x pprint with UTF-8 text
import pprint
class MyPrettyPrinter(pprint.PrettyPrinter):
"""PrettyPrint with UTF-8 text.
Refer to: http://stackoverflow.com/questions/10883399/unable-to-encode-decode-pprint-output
"""
def format(self, object, context, maxlevels, level):
if isinstance(object, unicode):
return (object.encode('utf8'), True, False)
return pprint.PrettyPrinter.format(self, object, context, maxlevels, level)
@priancho
priancho / my.cnf
Last active June 15, 2017 18:42
MariaDB Galera cluster my.cnf
# -----------------------#
# ----- References ----- #
# -----------------------#
#
# * Options for Galera cluster
# ------------------------------------------
# https://mariadb.com/kb/en/mariadb/galera-cluster/
# http://galeracluster.com/documentation-webpages/index.html
# https://www.digitalocean.com/community/tutorials/how-to-configure-a-galera-cluster-with-mariadb-10-1-on-ubuntu-16-04-servers
#
@priancho
priancho / spark-submit_log4j-properties.sh
Created August 1, 2017 01:48
Command-line options to use a custom log4j.properties file for both driver and executors
# use file:///my/absolute/path/to/log4j.proerties or file:my/relative/path/to/log4j.properties
spark-submit \
--driver-java-options "-Dlog4j.configuration=file:conf/log4j.properties" \
--files conf/log4j.properties \
--conf "spark.executor.extraJavaOptions='-Dlog4j.configuration=log4j.properties'" \
...