Skip to content

Instantly share code, notes, and snippets.

from typing import List, Dict, Callable
from collections import OrderedDict
from functools import partial
import lineflow as lf
import lineflow.datasets as lfds
import lineflow.cross_validation as lfcv
import torch
from torch.utils.data import DataLoader, SequentialSampler, RandomSampler
@cocopon
cocopon / dark.Xresources
Last active July 10, 2024 15:04
.Xresources for Iceberg
! special
*.foreground: #c6c8d1
*.background: #161821
*.cursorColor: #c6c8d1
! black
*.color0: #1e2132
*.color8: #6b7089
! red
@Voronenko
Voronenko / downgrademysql.md
Last active June 25, 2020 11:45
Downgrade mysql to mysql 5.6 on xenial

Install MySQL 5.6 in Ubuntu 16.04

Ubuntu 16.04 only provides packages for MySQL 5.7 which has a range of backwards compatibility issues with code written against older MySQL versions.

Oracle maintains a list of official APT repositories for MySQL 5.6, but those repositories do not yet support Ubuntu 16.04. However, the 15.10 repos will work for 16.04.

Uninstall existing mysql 5.7 if any

sudo apt remove mysql-client mysql-server libmysqlclient-dev mysql-common
@t-mart
t-mart / netrw quick reference.md
Last active November 10, 2024 02:21
A quick reference for Vim's built-in netrw file selector.
Map Action
<F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file
<del> Netrw will attempt to remove the file/directory
- Makes Netrw go up one directory
a Toggles between normal display, hiding (suppress display of files matching g:netrw_list_hide) showing (display only files which match g:netrw_list_hide)
c Make browsing directory the current directory
C Setting the editing window
d Make a directory
@knzm
knzm / bootstrap.sh
Last active June 25, 2016 10:11
install CUDA 7.0 and cuDNN 6.5 v2 on Ubuntu 14.04
#!/bin/sh
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
sudo apt-get install -y git subversion unzip
sudo apt-get install -y build-essential gfortran
sudo apt-get install -y python-virtualenv
sudo apt-get install -y python-dev
@zeroseis
zeroseis / disable-auto-android-file-transfer.md
Created September 14, 2015 17:28
Disable auto start for Android File Transfer
  • Close Android File Transfer
  • Open Activity Monitor and kill “Android File Transfer Agent”
  • Go to where you installed “Android File Transfer.app” (I have it under /Applications)
  • Ctrl+click –> “Show package contents”
  • Go to Contents/Resources
  • Rename “Android File Transfer Agent” to e.g. “Android File Transfer Agent_DISABLED”
  • Then go to “/Users/username/Library/Application Support/Google/Android File Transfer” and again rename the Agent app.
@mjwillson
mjwillson / ngrams_via_striding.py
Last active August 1, 2017 04:19
Matrix of sliding window ngrams without any copying via numpy striding tricks
from numpy.lib.stride_tricks import as_strided
def ngrams_via_striding(array, order):
itemsize = array.itemsize
assert array.strides == (itemsize,)
return as_strided(array, (max(array.size + 1 - order, 0), order), (itemsize, itemsize))
In [71]: a = numpy.arange(10)
In [72]: ngrams_via_striding(a, 4)
Out[72]:
@everpeace
everpeace / Why People Want Microservices.md
Last active November 8, 2022 10:37
マイクロサービス化が進む背景について考えてみた

マイクロサービス化が進む背景について考えてみた

最近マイクロサービスって流行ってますよね。バズってると言ってもいいくらい。

個人的には、「マイクロサービスって結局何なの?」とか、「SOAと何が違うわけ?」とかいう議論は苦手です。

でも「なんでみんなマイクロサービスで作りたいのか?なんでマイクロサービスで作られるサービスが多いのか?」にはすごく興味があるんです。

僕は今、シリコンバレーにある日系SIerの小さな子会社で駐在員をやっていますが、このエリアに居ると、とにかく最近、

「サービス全体が、独立した小さなサービスの集合で構成されるようになってきている」

@XVilka
XVilka / TrueColour.md
Last active October 29, 2024 09:43
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@neubig
neubig / crf.py
Created November 7, 2013 10:59
This is a script to train conditional random fields. It is written to minimize the number of lines of code, with no regard for efficiency.
#!/usr/bin/python
# crf.py (by Graham Neubig)
# This script trains conditional random fields (CRFs)
# stdin: A corpus of WORD_POS WORD_POS WORD_POS sentences
# stdout: Feature vectors for emission and transition properties
from collections import defaultdict
from math import log, exp
import sys