Skip to content

Instantly share code, notes, and snippets.

@FanchenBao
FanchenBao / my_queue.py
Last active October 24, 2023 04:20
A custom MyQueue class that avoids `NotImplementedError` when calling queue.qsize() method.
from multiprocessing.queues import Queue
import multiprocessing
# The following implementation of custom MyQueue to avoid NotImplementedError
# when calling queue.qsize() in MacOS X comes almost entirely from this github
# discussion: https://github.com/keras-team/autokeras/issues/368
# Necessary modification is made to make the code compatible with Python3.
class SharedCounter(object):
@latentflip
latentflip / gf.md
Last active April 14, 2021 03:29
vim, gf, and node

Vim, gf and node.

So, I just learned that gf exists. If your cursor is over a path in vim, and you type gf, it'll open that file/dir in a new buffer. You can also open in a new window/tab as detailed here.

In node, it'd be great if you could jump to a required file, huh? Trouble is, typically you don't put the .js on your require('./path/to/a/js/file'). No matter, vim has your back, just add set suffixesadd+=.js to your .vimrc and vim will try adding .js and see if it can find that file instead.

If you do a lot of spelunking in node_modules, it'd be great if you could jump to the directory of a required npm module too, right? A la, require('my-awesome-module'). Well, you can add set path+=$PWD/node_modules to your .vimrc too, and vim will add node_modules to the path, and jump to it's directory in node_modules (caveat: you must have opened vim from your project root for this too work).

For your cmd+c convenience: