Skip to content

Instantly share code, notes, and snippets.

@xiaoshuai
xiaoshuai / hive.py
Created Nov 16, 2018
hive.py : call hive command via python3
View hive.py
#!/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 Nov 16, 2018
hdfs.py : call hdfs command via python3
View hdfs.py
#!/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 Jul 24, 2018
redash chinese choropleth map 中国地区图支持
View countries.geo.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View 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 Nov 16, 2018
my slf4j via okhttp3.Interceptor
View okhttp3Interceptor.java
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;
View CompareJavaBase64Util.java
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 Feb 5, 2017
vagrant-grafana-influxdb
View 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