Skip to content

Instantly share code, notes, and snippets.

View mikeatm's full-sized avatar

Michael mikeatm

  • Technical University of Kenya
  • Nairobi
View GitHub Profile
@tamuhey
tamuhey / tokenizations_post.md
Last active March 30, 2024 19:00
How to calculate the alignment between BERT and spaCy tokens effectively and robustly

How to calculate the alignment between BERT and spaCy tokens effectively and robustly

image

site: https://tamuhey.github.io/tokenizations/

Natural Language Processing (NLP) has made great progress in recent years because of neural networks, which allows us to solve various tasks with end-to-end architecture. However, many NLP systems still require language-specific pre- and post-processing, especially in tokenizations. In this article, I describe an algorithm that simplifies calculating correspondence between tokens (e.g. BERT vs. spaCy), one such process. And I introduce Python and Rust libraries that implement this algorithm. Here are the library and the demo site links:

@juris
juris / redis-cluster-backup.sh
Last active March 21, 2023 14:27
Redis Cluster backup script
#!/bin/sh
readonly cluster_topology=$(redis-cli -h redis-cluster cluster nodes)
readonly slaves=$(echo "${cluster_topology}" | grep slave | cut -d' ' -f2,4 | tr ' ' ',')
readonly backup_dir="/opt/redis-backup"
mkdir -p ${backup_dir}
for slave in ${slaves}; do
master_id=$(echo "${slave}" | cut -d',' -f2)
@simonw
simonw / recover_source_code.md
Last active January 16, 2024 08:13
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

@t-nissie
t-nissie / 00anatase.en.md
Last active October 7, 2018 23:44
Quantum EspressoでTiO2アナターゼの電子のバンド構造とDOSを描く

Plot band structure and DOS of TiO2 anatase

Original files are in https://gist.github.com/t-nissie/ad99810ddf1bceb602f6 .

Preparation

  • Clone files in the gist as git clone https://gist.github.com/ad99810ddf1bceb602f6.git anatase08-k6x6x4-band-dos-gist.
  • cd anatase08-k6x6x4-band-dos-gist.
  • Get O.pw-mt_fhi.UPF and Ti.pw-mt_fhi.UPF form http://www.quantum-espresso.org/pseudopotentials/ .
  • Make symlinks to bands.x, dos.x, plotband.x and pw.x in the current directory, i.e. ln -s /SOMEWHERE/espresso-5.1.2/bin/bands.x.
@dfletcher
dfletcher / tsws
Last active July 21, 2018 12:47
Totally simple web server using Bash and netcat (nc)
Moved to a proprer repositoy, TSWS is a real boy now!
https://github.com/dfletcher/tsws
PRs welcomed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@d3noob
d3noob / .block
Last active January 21, 2020 23:56
Map using leaflet.js and d3,js overlaid
license: mit
@d3noob
d3noob / .block
Last active September 16, 2020 09:18
Map using leaflet.js and d3,js combined
license: mit