Skip to content

Instantly share code, notes, and snippets.

@xiaoshuai
xiaoshuai / hive.py
Created November 16, 2018 16:27
hive.py : call hive command via python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""hive.py: call hive command via python3"""
__author__ = "xiaoshuai, http://github.com/xiaoshuai"
__license__ = "GPL"
__version__ = "1.0.1"
import subprocess
import sys
from subprocess import check_output, CalledProcessError
@xiaoshuai
xiaoshuai / hdfs.py
Created November 16, 2018 16:26
hdfs.py : call hdfs command via python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""hdfs.py: call hdfs command via python3"""
__author__ = "xiaoshuai, http://github.com/xiaoshuai"
__license__ = "GPL"
__version__ = "1.0.1"
import os
import re
import subprocess
@xiaoshuai
xiaoshuai / countries.geo.json
Created July 24, 2018 02:14
redash chinese choropleth map 中国地区图支持
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@xiaoshuai
xiaoshuai / logger.h
Last active September 19, 2017 04:25
single c header colorful logger. base on https://github.com/zakird/zdlibc/blob/master/logger.h.
#include <stdio.h>
#include <stdarg.h>
#ifndef HEADER_SINGLELIBC_LOGGER_H
#define HEADER_SINGLELIBC_LOGGER_H
#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <math.h>
@xiaoshuai
xiaoshuai / okhttp3Interceptor.java
Last active November 16, 2018 16:28
my slf4j via okhttp3.Interceptor
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.List;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
public class CompareJavaBase64Util {
public static void main(String[] args) {
String str_1 = "abcABC123+-*/";
String str_2 = "YWJjQUJDMTIzKy0qLw==";
long l_1 = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
String encode_str_jdk = java.util.Base64.getEncoder().encodeToString(str_1.getBytes());
byte[] decode_byte_jdk = java.util.Base64.getDecoder().decode(str_2);
@xiaoshuai
xiaoshuai / vagrant-grafana-influxdb
Last active February 5, 2017 04:04
vagrant-grafana-influxdb
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.9.1"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# 设置常量
if ENV['DEV_VB_MEM']
memory = ENV["DEV_VB_MEM"]
else