Skip to content

Instantly share code, notes, and snippets.

View sKwa's full-sized avatar

Daniel Leybovich sKwa

  • Freelancer
  • Israel
View GitHub Profile
#!/usr/bin/env bash
#
#
# TODO: hostname
info() {
echo -e $( date "+[ %T.%3N ] ") "\033[01;32m[INF]\033[00m ${@}"
}
@sKwa
sKwa / download_jdk.sh
Last active July 18, 2017 15:28
Example how download latest JDK tar for Linux x64 platform programmatically
#!/usr/bin/env bash
#
# AUTHOR: Daniel Leybovich
BASE_URL="http://www.oracle.com"
PLATFORM="Linux x64"
ARCHIVE="tar.gz"
# get link to download page
SUFFIX=$(curl "${BASE_URL}/technetwork/java/javase/downloads/index.html" 2>/dev/null | grep 'name="JDK8"' | sed -nr 's/.*href="([^"]+)".*/\1/p')
@sKwa
sKwa / csv2json.py
Last active July 12, 2017 00:55
SQL query to JSON format (as demo)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
from datetime import date
NEWLINE, DELIMITER = '\x01\n', '\x02'
def json_serial(obj):