Skip to content

Instantly share code, notes, and snippets.

View davidwagnerkc's full-sized avatar
🚀

David Wagner davidwagnerkc

🚀
View GitHub Profile
@zxexz
zxexz / mutate_string.py
Last active September 22, 2023 16:39
Ever been told strings are immutable in Python? I wanted to test that.
#! /usr/bin/env python3
def replace_contents(
string: str,
search_string: str,
replace_string: str = "",
global_replace: bool = False,
terminate_char: str = ' ',
return_type: type = str,
memoryview_cast: str = '@c'
):
@soumith
soumith / gist:01da3874bf014d8a8c53406c2b95d56b
Last active March 28, 2022 16:53
Install PillowSIMD+libjpeg-turbo on Conda
conda uninstall --force pillow -y
# install libjpeg-turbo to $HOME/turbojpeg
git clone https://github.com/libjpeg-turbo/libjpeg-turbo
pushd libjpeg-turbo
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=$HOME/turbojpeg
make
make install
@drdavella
drdavella / mp-benchmark.py
Created December 19, 2017 18:54
Simple benchmark for testing data transfer between processes using Python's multiprocess module
#!/usr/bin/env python
from argparse import ArgumentParser
from multiprocessing import Process, Array, Pipe, Queue
from timeit import default_timer as timer
import numpy as np
def process_with_array(dest, source):
input_data = np.array(source, copy=False, dtype=float)
@qlkvg
qlkvg / test.py
Created July 7, 2016 07:32
viewing depth map from openni2 compatible device with opencv2
#!/usr/bin/python
import cv2
import numpy as np
from primesense import openni2
from primesense import _openni2 as c_api
openni2.initialize("<PATH TO OPENNI2 REDIST FOLDER>")
dev = openni2.Device.open_any()
depth_stream = dev.create_depth_stream()
depth_stream.start()
depth_stream.set_video_mode(c_api.OniVideoMode(pixelFormat = c_api.OniPixelFormat.ONI_PIXEL_FORMAT_DEPTH_100_UM, resolutionX = 640, resolutionY = 480, fps = 30))
@miglen
miglen / clouds.md
Last active April 15, 2023 20:05
AWS & GCP explained in simple English

Amazon Web Services (AWS) & Google Cloud Platform (GCP) explained in simple English

This guide is only representative from my point of view and it may not be accurate and you should go on the official AWS & GCP websites for accurate and detailed information. It's initially inspired by AWS in simple English and GCP for AWS professionals. The idea is to compare both services, give simple one-line explanation and examples with other software that might have similiar capabilities. Comment below for suggestions.

Category Service AWS GCP Description It's like
Compute IaaS Amazon Elastic Compute Cloud (EC2) Google Compute Engine Type-1 virtual servers VMware ESXi, Citrix XenServer
  PaaS AWS Elastic Beanstalk Google App Engine Running your app on a platform
@njsmith
njsmith / inject.py
Created April 9, 2012 23:39
A context-manager for DataFrames
import ctypes
PyFrame_LocalsToFast = ctypes.pythonapi.PyFrame_LocalsToFast
PyFrame_LocalsToFast.argtypes = [ctypes.py_object]
# Doing this with cython instead of ctypes would be much easier (and more
# robust). I just do it this way to keep the example self-contained.
frameobject_fields = [
# PyObject_VAR_HEAD
("ob_refcnt", ctypes.c_int64),