Skip to content

Instantly share code, notes, and snippets.

Lev E. Givon lebedov

Block or report user

Report or block lebedov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lebedov
lebedov / thumb_grid.py
Last active Mar 31, 2020
Display a grid of thumbnails.
View thumb_grid.py
#!/usr/bin/env python
"""
Display a grid of thumbnails.
"""
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
import PIL
@lebedov
lebedov / google_finance_intraday.py
Last active Mar 29, 2020
Retrieve intraday stock data from Google Finance.
View google_finance_intraday.py
#!/usr/bin/env python
"""
Retrieve intraday stock data from Google Finance.
"""
import csv
import datetime
import re
import pandas as pd
@lebedov
lebedov / mpi4py_pycuda_demo.py
Last active Mar 27, 2020
Demo of how to pass GPU memory managed by pycuda to mpi4py.
View mpi4py_pycuda_demo.py
#!/usr/bin/env python
"""
Demo of how to pass GPU memory managed by pycuda to mpi4py.
Notes
-----
This code can be used to perform peer-to-peer communication of data via
NVIDIA's GPUDirect technology if mpi4py has been built against a
CUDA-enabled MPI implementation.
@lebedov
lebedov / pyzmq_client_server_demo.py
Created Apr 11, 2012
Demo of how to extend multiprocessing.Process to communicate with pyzmq
View pyzmq_client_server_demo.py
#!/usr/bin/env python
"""
Demo of how to extend multiprocessing.Process to communicate with
pyzmq.
"""
import zmq
from multiprocessing import Process
import time
@lebedov
lebedov / ipynb_renumber.py
Last active Mar 15, 2020
Consecutively renumber prompts in an IPython notebook.
View ipynb_renumber.py
#!/usr/bin/env python
"""
Consecutively renumber prompts in an IPython notebook.
"""
# Copyright (c) 2015, Lev Givon
# All rights reserved.
# Distributed under the terms of the BSD license:
# http://www.opensource.org/licenses/bsd-license
@lebedov
lebedov / cuda_cpp_class.cu
Created Apr 24, 2017
How to "wrap" a CUDA kernel with a C++ class.
View cuda_cpp_class.cu
// How to "wrap" a CUDA kernel with a C++ class; the kernel must be defined outside of
// the class and launched from within a class instance's method.
#include <iostream>
#include <cuda.h>
#include <cuda_runtime.h>
#define LEN 10
__global__ void kernel(int *a, int *b, unsigned int N);
@lebedov
lebedov / lsof_funcs.py
Last active Mar 7, 2020
Python functions for finding open files and PIDs that have opened a file.
View lsof_funcs.py
#!/usr/bin/env python
"""
Python functions for finding open files and PIDs that have opened a file.
"""
import numbers
import subprocess
try:
@lebedov
lebedov / lasso_imshow.py
Last active Oct 2, 2019
How to interactively select part of an array displayed as an image with matplotlib.
View lasso_imshow.py
#!/usr/bin/env python
"""
How to interactively select part of an array displayed as an image with matplotlib.
"""
import matplotlib.pyplot as plt
from matplotlib.path import Path
from matplotlib.widgets import LassoSelector
import numpy as np
@lebedov
lebedov / pycuda_req_rep_demo.py
Created Apr 16, 2012
Interprocess communication with pyzmq and multiprocessing
View pycuda_req_rep_demo.py
#!/usr/bin/env python
"""
Pass data between processes started through the multiprocessing module
using pyzmq and process them with PyCUDA
"""
import numpy as np
import zmq
import multiprocessing as mp
@lebedov
lebedov / jpype_api_demo.py
Last active Aug 4, 2019
How to call pdfbox's API with JPype.
View jpype_api_demo.py
#!/usr/bin/env python3
"""
How to call pdfbox's API with JPype.
"""
import jpype
import jpype.imports
import numpy as np
You can’t perform that action at this time.