Skip to content

Instantly share code, notes, and snippets.

View hotienvu's full-sized avatar
🎯
Focusing

Ho Tien Vu hotienvu

🎯
Focusing
View GitHub Profile
package com.vho.hudisparkstreaming;
import org.apache.hudi.DataSourceWriteOptions;
import org.apache.hudi.config.HoodieWriteConfig;
import org.apache.hudi.hive.MultiPartKeysValueExtractor;
import org.apache.hudi.keygen.CustomKeyGenerator;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.sql.streaming.*;
import org.apache.avro.generic.GenericRecord
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.Path
import org.apache.parquet.avro.{AvroParquetReader, AvroReadSupport, AvroSchemaConverter}
import org.apache.parquet.filter2.compat.FilterCompat
import org.apache.parquet.filter2.predicate.{FilterApi, UserDefinedPredicate}
import org.apache.parquet.format.converter.ParquetMetadataConverter
import org.apache.parquet.hadoop.{ParquetFileReader, ParquetInputFormat}
import org.apache.parquet.io.api.Binary
// debit
$jq.map($jq("td.cT-bodyTableColumn3 span.cT-line1.cM-numberCell"), function(r, i) { return parseFloat(r.innerHTML.replace(",", "").substring(4)); }).reduce(function(acc, x) { return acc + x; })
// credit
$jq.map($jq("td.cT-bodyTableColumn4 span.cT-line1.cM-numberCell"), function(r, i) { return parseFloat(r.innerHTML.replace(",", "").substring(4)); }).reduce(function(acc, x) { return acc + x; })
## create new keystore
keytool -genkeypair [-keyalg EC -keysize 256 -sigalg SHA256withECDSA] -keystore keystore.jks -alias domain.com
## list entries in keystore
keytool -list -keystore keystore.jks -v
## concatinate multiple keystores
keytool -importkeystore -srckeystore keystore1.jks -destkeystore keystore2.jks -deststoretype pkcs12
ssh-copy-id -i ~/.ssh/id_rsa.pub vagrant@192.168.1.101
@hotienvu
hotienvu / get_hosts_info
Last active August 29, 2015 14:04
Get Ip address and hostname of the current host
echo "$(ifconfig eth0|grep "inet add"|awk -F\: '{print $2}'|awk '{print $1}')" "$(hostname)"
@hotienvu
hotienvu / ngSize
Last active December 14, 2015 15:08
My custom directive to 2 way-bind the size attribute of <select>. The issue is open here https://github.com/angular/angular.js/issues/1619
myApp.directive('ngSize', function() {
return {
restrict:'A',
scope: {
ngSize: '='
},
link: function(scope, elem, attrs) {
scope.$watch("ngSize", function(newVal, oldVal) {
angular.element(elem).attr('size', newVal);
});