Skip to content

Instantly share code, notes, and snippets.

@yijia2413
yijia2413 / mysql-to-hive.sh
Created December 8, 2015 02:37
use sqoop import data to hive from mysql
#!/bin/bash
set -ex
jdbc_url='172.16.8.xxx:3306'
mysql_db='kafka_data'
mysql_user_name='kafka'
mysql_passwd='kafka'
mysql_tb='project'
hive_db='yijia'
@yijia2413
yijia2413 / setup_teamviewer.sh
Created December 8, 2016 18:54
无公网 ip 远程连接的折中方案
#!/bin/bash
set -ex
yum install -y wget
wget https://download.teamviewer.com/download/teamviewer.i686.rpm
yum install teamviewer.i686.rpm -y
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#include<iostream>
#include<cstring>
using namespace std;
class String {
public:
String(const char *str);
String(const String &other);
~String(void);
@yijia2413
yijia2413 / unicode.py
Created October 13, 2017 08:49
Python unicode to Chinese
# python 2.7
'\\uxxxx'.decode('unicode-escape')
# python 3.x
'\\uxxxx'.encode('ascii').decode('unicode-escape')
'\\uxxxx'.decode('unicode-escape')
@yijia2413
yijia2413 / publish_redis.py
Created November 23, 2017 08:51
Redis pub & sub
#coding: utf8
import time
import redis
from multiprocessing import Process
def pub(r, num_msg):
for i in range(num_msg):
r.publish('channel', 'offset %d' % i)
@yijia2413
yijia2413 / client.py
Last active November 27, 2017 12:16
socket|epoll
#coding: utf8
import socket
import time
import multiprocessing
def socket_instance():
c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
c.connect(('127.0.0.1', 1024))
return c
@yijia2413
yijia2413 / ss_docker.sh
Created December 1, 2017 05:12
ss in cloud env, using docker
#!/bin/bash
set -ex
PASSWD='helloworld1234'
yum update -y
yum install -y yum-utils device-mapper-persistent-data lvm2
yum install docker-ce -y
@yijia2413
yijia2413 / basic.vimrc
Created December 13, 2017 14:59
vimrc
set nu
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - amix@amix.dk
"
" Version:
" 6.0 - 01/04/17 14:24:34
"
" Blog_post:
@yijia2413
yijia2413 / vagrantfile
Created December 13, 2017 15:07
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at