Skip to content

Instantly share code, notes, and snippets.

View kose-y's full-sized avatar

Seyoon Ko kose-y

View GitHub Profile
@beam2d
beam2d / invidx.py
Last active October 28, 2021 21:34
Inverted index in NumPy
import numpy as np
class InvertedIndex(object):
def __init__(self, x):
self.J = np.argsort(x)
D = np.ediff1d(x[self.J], to_begin=1, to_end=1)
self.I = np.repeat(np.arange(len(D)), D)
def __getitem__(self, k):
@robwhess
robwhess / gh_classroom_collect.py
Last active March 13, 2023 18:03
Script to collect a set of assignments from GitHub Classroom.
#!/user/bin/env python
#
# This is a simple python script to clone all of the repositories for an
# assignment managed via GitHub Classroom. It has a dependency on the
# requests module, so to use it, you must:
#
# pip install requests
#
# You can run the script with the '-h' option to get info on its usage.
@nvictus
nvictus / runlength.py
Last active October 7, 2023 19:54
NumPy run-length encoding / decoding
"""Run Length Encoding utilities for NumPy arrays.
Authors
-------
- Nezar Abdennur
- Anton Goloborodko
"""
from __future__ import division, print_function
import numpy as np
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
@gmarkall
gmarkall / numba_cuda_mpi.py
Created March 30, 2015 09:45
Numba CUDA + MPI example
from __future__ import print_function
from mpi4py import MPI
from numba import cuda
import numpy as np
mpi_comm = MPI.COMM_WORLD
# Input data size
total_n = 10
@kastnerkyle
kastnerkyle / conv_deconv_vae.py
Last active April 21, 2023 01:18
Convolutional Variational Autoencoder, modified from Alec Radford at (https://gist.github.com/Newmu/a56d5446416f5ad2bbac)
# Alec Radford, Indico, Kyle Kastner
# License: MIT
"""
Convolutional VAE in a single file.
Bringing in code from IndicoDataSolutions and Alec Radford (NewMu)
Additionally converted to use default conv2d interface instead of explicit cuDNN
"""
import theano
import theano.tensor as T
from theano.compat.python2x import OrderedDict
@kdungs
kdungs / Makefile
Created June 22, 2014 18:56
A Makefile for LaTeX with intermediate running of biber.
PROJECT=main
build/${PROJECT}.pdf: build/${PROJECT}.bbl
lualatex --output-directory=build ${PROJECT}
build/${PROJECT}.bbl: build/${PROJECT}.bcf
biber build/${PROJECT}
build/${PROJECT}.bcf: ${PROJECT}.tex
lualatex --output-directory=build ${PROJECT}