Skip to content

Instantly share code, notes, and snippets.

View ihainan's full-sized avatar
😉
Hey

Jigao Fu ihainan

😉
Hey
View GitHub Profile
@ihainan
ihainan / XInputTestV1.ahk
Created July 16, 2023 02:48
XInputTestV1.ahk
; Example: Control the vibration motors using the analog triggers of each controller.
#Include <XInput>
XInput_Init()
Gui, +AlwaysOnTop
Gui, Add, Text, w300, Note: For Xbox controller 2013 and newer (anything newer than the Xbox 360 controller), this script can only detect controller events if a window it owns is active (like this one).
Gui, Add, Edit, w300 h30 +ReadOnly
Gui, Add, Edit, w300 h30 +ReadOnly
Gui, Add, Edit, w300 h30 +ReadOnly
Gui, Add, Edit, w300 h30 +ReadOnly
@ihainan
ihainan / fcp.sh
Created September 20, 2022 02:54
SCP-Like FTP Command
#!/usr/bin/env bash
set -e
# Usage: fcp spark4@9.30.71.31:/home/mlzdev/imlhome/spark4/configuration/keystore.jks .
# Usage: fcp fcp.sh spark4@9.30.71.31:/home/mlzdev/imlhome/spark4/configuration
die() {
echo "[FATAL] $1" >&2 && exit 1
}
// ==UserScript==
// @name Imgur Helper
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://imgur.com/a/*
// @match https://imgur.com
// @match https://imgur.com/*
// @icon https://www.google.com/s2/favicons?domain=imgur.com
#!/usr/bin/env bash
file_name=$1
ffmpeg_ss=$2
file_name_no_extension=$(basename "$file_name" .mp4)
ffmpeg -i "$file_name" -ss "$ffmpeg_ss" -c copy "$file_name_no_extension.tmp.mp4"
ffmpeg -i "$file_name_no_extension.tmp.mp4" -strict -2 -af "volume=20dB" "$file_name_no_extension.final.mp4"
[INFO] com.ibm.analytics.iml:iml-library:pom:0.1.0-20170705
[INFO] +- com.ibm.analytics.wml.ml-algorithms:ml-algorithms-scala-spark-2.3:jar:LATEST:compile
[INFO] | +- (com.ibm.analytics.wml.ml-utils:ml-utils-scala-spark-2.3:jar:2.1.0.524-201906192307:compile - omitted for conflict with LATEST)
[INFO] | \- (com.ibm.analytics.wml.ml-pipeline:ml-pipeline-scala-spark-2.3:jar:2.1.0.863-201906192340:compile - omitted for conflict with LATEST)
[INFO] +- com.trueaccord.scalapb:scalapb-runtime_2.11:jar:0.6.0:compile
[INFO] | +- org.scala-lang:scala-library:jar:2.11.11:compile
[INFO] | +- com.trueaccord.lenses:lenses_2.11:jar:0.4.12:compile
[INFO] | | \- (org.scala-lang:scala-library:jar:2.11.11:compile - omitted for duplicate)
[INFO] | +- com.lihaoyi:fastparse_2.11:jar:0.4.2:compile
[INFO] | | +- (org.scala-lang:scala-library:jar:2.11.8:compile - omitted for conflict with 2.11.11)

Spark / MLeap Upgradation

Spark 2.2

  • New algorithms in DataFrame-based API
    • SPARK-14709: LinearSVC (Linear SVM Classifier) (Scala/Java/Python/R)
    • SPARK-19635: ChiSquare test in DataFrame-based API (Scala/Java/Python)
    • SPARK-19636: Correlation in DataFrame-based API (Scala/Java/Python)
    • SPARK-13568: Imputer feature transformer for imputing missing values (Scala/Java/Python)
  • SPARK-18929: Add Tweedie distribution for GLMs (Scala/Java/Python/R)
// ==UserScript==
// @name Stay in IGN
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://*.ign.com/*
// @grant none
// @require https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js
// ==/UserScript==
// SCALA_VERSION=2.11.8 ALMOND_VERSION=0.3.1
interp.load.ivy("org.apache.httpcomponents" % "httpclient" % "4.5.7")
object Solution {
def powMod(x: Int, y: Int, mod: Int): Int = {
if (y == 0) 1
else {
val half = powMod(x, y / 2, mod)
if (y % 2 == 0) half * half % mod
else (half * half % mod) * (x % mod) % mod
}
}
object Solution498 {
def findDiagonalOrder(matrix: Array[Array[Int]]): Array[Int] = {
if (matrix.length == 0 || matrix(0).length == 0) Array.empty[Int]
else {
val (row, column) = (matrix.length - 1, matrix(0).length - 1)
var flag = true
(0 to row + column).flatMap { sum =>
val (low, high) = (0 max (sum - column), row min sum)
val range = if (flag) (high to low by -1) else (low to high)
flag = !flag