Skip to content

Instantly share code, notes, and snippets.

View msdotnetclr's full-sized avatar

Jian (Miracle) Zhou msdotnetclr

View GitHub Profile
{
"name": "Digital Labs Technologies",
"children": [
{
"name": "Data Analytics",
"children": [
{
"name": "Data Engineer",
"children": [
{"name": "AgglomerativeCluster", "value": 3938},
@msdotnetclr
msdotnetclr / process.txt
Last active June 10, 2022 17:41
Build Hadoop 2.9.1 with SNAPPY support in CentOS 6.5
######## execute as root ######
sudo su
service iptables stop
chkconfig iptables off
# centos 7:
# systemctl disable firewalld
# systemctl stop firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
reboot
sudo su
@msdotnetclr
msdotnetclr / Visa-Reciprocity-and-Civil-Documents-by-Country-China.txt
Created April 12, 2018 15:00
U.S. Visa: Reciprocity and Civil Documents by Country > China
https://travel.state.gov/content/travel/en/us-visas/Visa-Reciprocity-and-Civil-Documents-by-Country/China.html
@msdotnetclr
msdotnetclr / youtube-content-domain.txt
Created March 1, 2018 04:10
Restrict YouTube content on your network or managed devices
www.youtube.com
m.youtube.com
youtubei.googleapis.com
youtube.googleapis.com
www.youtube-nocookie.com
From https://support.google.com/a/answer/6214622?hl=en
@msdotnetclr
msdotnetclr / backup-restore-docker-named-volume.md
Created February 27, 2018 17:25
Backup and restore named Docker volume

To backup some_volume to /tmp/some_archive.tar.bz2 simply run:

docker run -it -v some_volume:/volume -v /tmp:/backup alpine \
    tar -cjf /backup/some_archive.tar.bz2 -C /volume ./

And to restore run:

@msdotnetclr
msdotnetclr / presto-cli-sample.sh
Last active February 13, 2018 20:34
Presto CLI script example
export PRESTO_PASSWORD=*****
./presto194 \
--server https://presto.server:31443 \
--catalog <mycatalog> \
--keystore-password password \
--keystore-path /mnt/c/private/presto-client.jks \
--schema <myschema> \
--output-format TSV \
--user <username> \
@msdotnetclr
msdotnetclr / NvvCSVClasses.cs
Created February 5, 2018 16:54
NVV CSV Classes
/*****************************************************/
/*** Copyright (c) 2014 Vladimir Nikitenko ***/
/*** Code Project Open License (CPOL) ***/
/*** (http://www.codeproject.com/info/cpol10.aspx) ***/
/*****************************************************/
/***** NvvCSVClasses.cs *****
===== History:
@msdotnetclr
msdotnetclr / import-gzip-csv-from-web-to-power-bi.md
Last active November 14, 2022 17:02
Import GZipped CSV file from the web to Power BI
  1. Get Data -> Web, choose "Basic", enter URL. E.g. https://myteststorage.blob.core.windows.net/pmdogy/20180129/csv/shrmyd/shrmyd.csv.gz?st=2018-02-05T08%3A57%3A00Z&se=2018-02-05T16%3A57%3A00Z&sp=r&sv=2017-04-17&sr=b&sig=PbFVzUv%2FBwrOCR0RcuzgVw%2F9nVFFmbo%2BXOJusO1yo9E%3D Power BI Query Editor will display a single icon for the web blob with the source domain name and content size.
  2. Go to View -> Advanced Editor. The script will be like this:
let
    Source = Web.Contents("https://myteststorage.blob.core.windows.net/pmdogy/20180129/csv/shrmyd/shrmyd.csv.gz?st=2018-02-05T08%3A57%3A00Z&se=2018-02-05T16%3A57%3A00Z&sp=r&sv=2017-04-17&sr=b&sig=PbFVzUv%2FBwrOCR0RcuzgVw%2F9nVFFmbo%2BXOJusO1yo9E%3D")
in
    Source
@msdotnetclr
msdotnetclr / redis-conditional-set.txt
Last active April 1, 2024 13:26
Redis LUA: set or update key if new value is higher/lower than current
# Basic benchmarks
# SET key val # 87489.06
# SETRANGE key2 6 "Redis" # 75757.58 req/s
# INCR key 245 # 70224.72 req/s
# INCRBY key 245 22 # 67114.09 req/s
# EVAL SET key val # 46296.29 req/s
# SETIFHIGHER (set or update key if new value is higher than current) # 41666.67 req/s
# if not exists return OK , if updated return the increment , if not updated return 0
SCRIPT LOAD "local c = tonumber(redis.call('get', KEYS[1])); if c then if tonumber(ARGV[1]) > c then redis.call('set', KEYS[1], ARGV[1]) return tonumber(ARGV[1]) - c else return 0 end else return redis.call('set', KEYS[1], ARGV[1]) end"