This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
GPUID_PID_RAM=`nvidia-smi | sed '0,/Processes:/d' | grep -oe "\<[0-9]\+\(MiB\)\?\>" | xargs` | |
set -- $GPUID_PID_RAM | |
while [ -n "$3" ]; do | |
_u=`ps -q "$2" -eo "uname" | tail -n +2` | |
printf '%s is using %s on GPU %s\n' "$_u" "$3" "$1" | |
shift 3 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:DeleteAllComments() range | |
" Deletes all tex comments (trailing and full line) | |
" without changing paragraph formatting. | |
" Put this function in $HOME/.vim/ftplugin/tex.vim | |
let l:save = winsaveview() " Save cursor position | |
" First: Remove full comment lines completely (to retain formatting) | |
global/\m^\s*%.*$/delete | |
" Second: Remove trailing comments (but dont match escaped \%) | |
%smagic/[^\\]\zs%.*//eI | |
" Third: Join multiple blank lines to one (aesthetics) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse, itertools | |
parser = argparse.ArgumentParser() | |
parser.add_argument('input', help="Initial text for generating anagrams") | |
parser.add_argument('-d', '--dict', default='/usr/share/dict/cracklib-small', | |
help="A word list such as '/usr/share/dict/words' or '/usr/dict/words'") | |
args = parser.parse_args() | |
with open(args.dict, 'r') as fh: | |
valid_words = set(line.strip().lower() for line in fh) | |
anagrams = set(''.join(a) for a in itertools.permutations(list(args.input.lower())) if all(w in valid_words for w in ''.join(a).split())) | |
for anagram in sorted(anagrams): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Authors: Olivier Grisel <[email protected]> | |
# Mathieu Blondel <[email protected]> | |
# Lars Buitinck <[email protected]> | |
# Robert Layton <[email protected]> | |
# Jochen Wersdörfer <[email protected]> | |
# Roman Sinayev <[email protected]> | |
# | |
# License: BSD 3 clause | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Snippets (or reanimating skeletons) in plain vim which just uses ONE LINE OF CODE: | |
" The following is one single abbreviation for all: | |
" The graveyard. | |
" - Visual selection -> :w\g/<filename> will create a grave | |
" - Reanimating a skeleton by -> :r\g/<filename> | |
" Of course you can get a list of your skeletons by hitting <tab> instead of writing a filename (wildmenu). | |
" Or hit *.py<Tab> to get a list of only python snippets. | |
" - Editing a skeleton... -> :e\g/<filename> | |
cabbrev \g $HOME/.vim/graveyard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
All-but-the-Top: Simple and Effective Postprocessing for Word Representations | |
Paper: https://arxiv.org/abs/1702.01417 | |
Last Updated: Fri 15 Nov 2019 11:47:00 AM CET | |
**Prior version had serious issues, please excuse any inconveniences.** | |
""" | |
import numpy as np | |
from sklearn.decomposition import PCA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 | |
call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |