Skip to content

Instantly share code, notes, and snippets.

View raidery's full-sized avatar
🎯
Focusing

Raider raidery

🎯
Focusing
  • IBM
  • China
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@raidery
raidery / ML0120EN-4.1-Review-RBMMNIST.ipynb
Created December 29, 2019 15:23
Created on Cognitive Class Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@raidery
raidery / groupby_agg.scala
Created January 9, 2020 09:38
Spark SQL: apply aggregate functions to a list of columns
//https://stackoverflow.com/questions/33882894/spark-sql-apply-aggregate-functions-to-a-list-of-columns
val Claim1 = StructType(Seq(StructField("pid", StringType, true),StructField("diag1", StringType, true),StructField("diag2", StringType, true), StructField("allowed", IntegerType, true), StructField("allowed1", IntegerType, true)))
val claimsData1 = Seq(("PID1", "diag1", "diag2", 100, 200), ("PID1", "diag2", "diag3", 300, 600), ("PID1", "diag1", "diag5", 340, 680), ("PID2", "diag3", "diag4", 245, 490), ("PID2", "diag2", "diag1", 124, 248))
val claimRDD1 = sc.parallelize(claimsData1)
val claimRDDRow1 = claimRDD1.map(p => Row(p._1, p._2, p._3, p._4, p._5))
val claimRDD2DF1 = sqlContext.createDataFrame(claimRDDRow1, Claim1)
val l = List("allowed", "allowed1")
val exprs = l.map((_ -> "sum")).toMap
@raidery
raidery / tmux-cheatsheet.markdown
Created November 10, 2021 05:39 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@raidery
raidery / AESUtil.java
Created June 26, 2023 08:23
Java code for using IvParameterSpec, AES/CFB/PKCS5Padding with SecureRandom for encryption and decryption
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.security.SecureRandom;
import java.util.Base64;
public class AESUtil {
private static final String ALGORITHM = "AES";
private static final String CIPHER_ALGORITHM = "AES/CFB/PKCS5Padding";
private static final int KEY_SIZE = 128;