Skip to content

Instantly share code, notes, and snippets.

Avatar

Andreas Grivas andreasgrv

View GitHub Profile
@JohnGiorgi
JohnGiorgi / biaffine_classifier.py
Last active Nov 24, 2021
PyTorch implementation of the biaffine attention operator from "End-to-end neural relation extraction using deep biaffine attention" (https://arxiv.org/abs/1812.11275) which can be used as a classifier for binary relation classification. If you spot an error or have an improvement, let me know!
View biaffine_classifier.py
import torch
class BiaffineAttention(torch.nn.Module):
"""Implements a biaffine attention operator for binary relation classification.
PyTorch implementation of the biaffine attention operator from "End-to-end neural relation
extraction using deep biaffine attention" (https://arxiv.org/abs/1812.11275) which can be used
as a classifier for binary relation classification.
@koreyou
koreyou / shuf
Created Jan 6, 2018
Linux shuf command with seed option
View shuf
#!/bin/bash
# seeding adopted from https://stackoverflow.com/a/41962458/7820599
get_seeded_random()
{
seed="$1";
openssl enc -aes-256-ctr -pass pass:"$seed" -nosalt \
</dev/zero 2>/dev/null;
}
@florianbeer
florianbeer / set-tmux-title
Created Apr 21, 2015
Set tmux pane title to short hostname on ssh connections
View set-tmux-title
ssh() {
if [ "$(ps -p $(ps -p $$ -o ppid=) -o comm=)" = "tmux" ]; then
tmux rename-window "$(echo $* | cut -d . -f 1)"
command ssh "$@"
tmux set-window-option automatic-rename "on" 1>/dev/null
else
command ssh "$@"
fi
}
@dwyerk
dwyerk / concave_hulls.ipynb
Created Apr 12, 2014
concave hulls using shapely and scipy
View concave_hulls.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@killercup
killercup / pandoc.css
Created Jul 3, 2013
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
View pandoc.css
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
@codemonkey85
codemonkey85 / objSerialization.cpp
Last active Nov 26, 2022
An example of how to serialize / deserialize a C++ struct to and from a disk file.
View objSerialization.cpp
struct OBJECT{ // The object to be serialized / deserialized
public:
// Members are serialized / deserialized in the order they are declared. Can use bitpacking as well.
DATATYPE member1;
DATATYPE member2;
DATATYPE member3;
DATATYPE member4;
};
void write(const std::string& file_name, OBJECT& data) // Writes the given OBJECT data to the given file name.
@ttezel
ttezel / gist:4138642
Last active Aug 17, 2022
Natural Language Processing Notes
View gist:4138642

#A Collection of NLP notes

##N-grams

###Calculating unigram probabilities:

P( wi ) = count ( wi ) ) / count ( total number of words )

In english..

@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active Jan 15, 2023
shell/bash generate random alphanumeric string
View bash.generate.random.alphanumeric.string.sh
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

View tmux_cheatsheet.markdown

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: