Skip to content

Instantly share code, notes, and snippets.

View timeartist's full-sized avatar

Adi Wabisabi timeartist

  • Confluent
  • 8500 ft
View GitHub Profile
@hermanbanken
hermanbanken / Dockerfile
Last active April 22, 2024 10:53
Compiling NGINX module as dynamic module for use in docker
FROM nginx:alpine AS builder
# nginx:alpine contains NGINX_VERSION environment variable, like so:
# ENV NGINX_VERSION 1.15.0
# Our NCHAN version
ENV NCHAN_VERSION 1.1.15
# Download sources
RUN wget "http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O nginx.tar.gz && \
@KyleJamesWalker
KyleJamesWalker / googleLogin.py
Last active June 7, 2017 13:49
Login to Google (browser style)
# encoding: utf-8
from __future__ import unicode_literals
import os
import requests
import sys
def get_google_auth_session(username, password):
session = requests.Session()
@utilitarianexe
utilitarianexe / threadify
Last active December 27, 2015 15:19
Python Decorator to turn a normal function into a function that splits its work among threads. First argument of original function is a list that is split into pieces for each thread to run separately.
import threading
from functools import wraps
def threadify(num_threads,is_method=True,outputs_list=False,outputs_bool = False,outputs_gen=False):
''' Apply this decorator to a function. It turns that function into a new one that splits its work up among threads. This only works on special functions though. The first argument must be a list. This list will be split into even pieces with each piece passed to a thread. Your function must return either None,a list, or a dictionary. If it is a list make sure you specify outputs list as true. Lists are not guaranteed to return in order so dicts are best in most cases. The return of each thread will automatically be combined for you. The overhead is quite low'''
def threadify_real(func):
def threaded(*args,**kwargs):
threads = []