Skip to content

Instantly share code, notes, and snippets.

View malteos's full-sized avatar

malteos malteos

  • Berlin, Germany
View GitHub Profile
@malteos
malteos / mmr-wikisim.txt
Last active August 29, 2015 14:13
Mean reciprocal rank for Wiki Similarity Measures
WikiSim results
Article See Also (unsortiert) CoCit (sortiert) CPA (sortiert)
----------------------------------------------------------------------
z a, b, c, ,d 1: b, 2:c 1: d
y e, f 1: f, 2: q, 3: x 1: p, 2: q, 3: a, 4: f
x a, b 1: b, 2: a 1: a, 2: b
----------------------------------------------------------------------
@malteos
malteos / football-world-cup-2014-brazil-all-players.txt
Created February 4, 2015 09:32
Football World Cup 2014 Brazil - All Players
Fabrice OLINGA
Luke SHAW
Nabil BENTALEB
Divock ORIGI
Adnan JANUZAJ
Carlos GRUEZO
Raheem STERLING
Jose GIMENEZ
Julian GREEN
Sead KOLASINAC
@malteos
malteos / YoutubeUpload.js
Created July 24, 2015 14:27
YoutubeUploadJS - Node JS program for uploading videos to YouTube via DataAPI v3 & CmdLine
/******************************
* YoutubeUploadJS
* *****************************
* Node JS program for uploading videos to YouTube via DataAPI v3 & CmdLine
* (inspired by https://github.com/rajeshujade/nodejs-upload-youtube-video-using-google-api )
*
* Run with: nodejs ytvideoupload.js <video-file> <video-title> <video-description> [<config-json>]
*
* Requires config.json in home directory or defined as argument. Example:
* {
@malteos
malteos / auc-gammaidx.py
Last active May 23, 2016 17:17
AUC + GAMMAIDX
def auc(y_true, y_val, plot=False):
"""
Computes the AUC (area under the receiver operator curve).
For example, y val could be the output of a learning algorithm (binary logistic regression, ...).
:param y_true: true labels in {-1,+1}
:param y_val: predicted value where lower values tend to correspond to label -1 and higher values to label +1
:param plot: whether to plot the ROC curve or not
:return: returns the AUC
"""
sum_cond_pos = np.count_nonzero(y_true == 1)

Testing Queries for CirrusSearch extension

As produced by SimpleKeywordFeature.doApply() (boosting has no effect)

curl -XPOST localhost:9200/wiki_content/_search?pretty -d '
{
  "_source": [
    "title"
  ],
  "query": {

Returns only 'Main Page'

curl -XPOST localhost:9200/wiki_content/_search?pretty -d '
{
  "_source": [
    "title"
  ],
  "query": {
    "bool": {
      "should": [
@malteos
malteos / Mixxx_2deck_keyboard_mapping.kbd.cfg
Created April 20, 2017 13:24
Keyboard mapping for Mixxx DJ software. High-mid-low equalizer.
[AutoDJ]
[Master]
[VinylControl]
[PreviewDeck1]
[Channel1]
play y
@malteos
malteos / letsencrypt-ssl-dns-docker.sh
Created December 2, 2018 12:38
Obtain Lets-Encrypt SSL Certificate via Docker DNS challenge
# Obtain Lets-Encrypt SSL Certificate via Docker DNS challenge
# adjust:
# - domains (-d foo.me)
mkdir letsencrypt_etc letsencrypt_var
docker run -it --rm --name certbot \
-v "./letsencrypt_etc:/etc/letsencrypt" \
-v "./letsencrypt_var:/var/lib/letsencrypt" \
certbot/certbot certonly -d foo.me -d *.foo.me --manual --preferred-challenges dns
import argparse
import os
import torch
from transformers.models.auto import AutoModelForCausalLM
LAYER_FILE_PREFIX = 'layer_'
MODEL_FILE_PREFIX = 'model_'
EMBEDDING_LAYER_INDEX = 1
# Copyright 2022 EleutherAI and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,