Skip to content

Instantly share code, notes, and snippets.

View shwangdev's full-sized avatar
🎯
Focusing

王翔(Shawn Wang) shwangdev

🎯
Focusing
View GitHub Profile
@girisandeep
girisandeep / spark-custom-partitioner.scala
Last active December 9, 2020 02:54
An example of creating a custom partitioners in spark using scala
import org.apache.spark.Partitioner
class TwoPartsPartitioner(override val numPartitions: Int) extends Partitioner {
def getPartition(key: Any): Int = key match {
case s: String => {
if (s(0).toUpper > 'J') 1 else 0
}
}
}
@mbollmann
mbollmann / attention_lstm.py
Last active June 26, 2023 10:08
My attempt at creating an LSTM with attention in Keras
class AttentionLSTM(LSTM):
"""LSTM with attention mechanism
This is an LSTM incorporating an attention mechanism into its hidden states.
Currently, the context vector calculated from the attended vector is fed
into the model's internal states, closely following the model by Xu et al.
(2016, Sec. 3.1.2), using a soft attention model following
Bahdanau et al. (2014).
The layer expects two inputs instead of the usual one:
@AaronTheApe
AaronTheApe / emacs.repo
Created May 8, 2013 12:05
Emacs 24 CentOS Repo
[emacs]
name=Emacs 24.2 repo
baseurl=http://pj.freefaculty.org/EL/6/x86_64/
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://pj.freefaculty.org/EL/PaulJohnson-BinaryPackageSigningKey
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 22, 2024 17:28
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname