Skip to content

Instantly share code, notes, and snippets.

View jtlz2's full-sized avatar

jtlz2

View GitHub Profile
MOZILLA/MDN/kuma master ✔
▶ docker-compose up
Starting kuma_mysql_1 ... done
Starting kuma_redis_1 ... done
Starting kuma_elasticsearch_1 ... done
Recreating kuma_api_1 ... done
Recreating kuma_kumascript_1 ... done
Recreating kuma_web_1 ... done
Recreating kuma_worker_1 ... done
Attaching to kuma_redis_1, kuma_mysql_1, kuma_elasticsearch_1, kuma_api_1, kuma_kumascript_1, kuma_web_1, kuma_worker_1
@sandboxws
sandboxws / mongoio_sink.py
Created March 9, 2018 01:45
WIP MongoDB Apache Beam Sink for Python
__all__ = ['WriteToMongo']
import json
from pymongo import MongoClient
from apache_beam.transforms import PTransform
from apache_beam.io import iobase
class _MongoSink(iobase.Sink):
"""A :class:`~apache_beam.io.iobase.Sink`."""
@kylehounslow
kylehounslow / client.py
Last active April 23, 2024 10:58
Send and receive images using Flask, Numpy and OpenCV
from __future__ import print_function
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
@dlebech
dlebech / mongodbio.py
Last active July 15, 2022 22:20
Super-simple MongoDB Apache Beam transform for Python
# Public Domain CC0 license. https://creativecommons.org/publicdomain/zero/1.0/
"""MongoDB Apache Beam IO utilities.
Tested with google-cloud-dataflow package version 2.0.0
"""
__all__ = ['ReadFromMongo']
import datetime
@olih
olih / jq-cheetsheet.md
Last active May 3, 2024 05:32
jq Cheet Sheet

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

@stavxyz
stavxyz / 1fail.md
Last active May 18, 2018 13:21
uwsgi docker fail -- alpine 3.2

now trying with the uwsgi-python package

https://pkgs.alpinelinux.org/package/main/x86_64/uwsgi-python

This is when trying to run uwsgi:

server_1 | open("./http_plugin.so"): No such file or directory [core/utils.c line 3675]
server_1 | !!! UNABLE to load uWSGI plugin: Error loading shared library ./http_plugin.so: No such file or directory !!!
server_1 | open("./python_plugin.so"): No such file or directory [core/utils.c line 3675]
@safecat
safecat / gist:f450ce5ed5a51b3b6f32
Last active July 28, 2022 11:24
ApacheBench for Mac
# ATTENTION PLEASE!
# NOTE BY @riwazp7
# Note for future visitors of this gist: Mac OS has Apache Benchmark by default ab --help
curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.2.tar.gz
tar -xzf libtool-2.4.2.tar.gz
cd libtool-2.4.2
./configure && make && sudo make install
# brew install 'https://raw.github.com/simonair/homebrew-dupes/e5177ef4fc82ae5246842e5a544124722c9e975b/ab.rb'
@iainsproat
iainsproat / gist:8378720
Created January 12, 2014 00:11
Git: stash work in progress and move it to a new branch
  • make changes
  • git stash save
  • git checkout -b xxx
  • git stash pop

where xxx is the new branch name

@treyhunner
treyhunner / datetime_modulo.py
Last active May 20, 2020 01:47
Python modulo support for datetime
import datetime as dt
class datetime(dt.datetime):
def __divmod__(self, delta):
seconds = int((self - dt.datetime.min).total_seconds())
remainder = dt.timedelta(
seconds=seconds % delta.total_seconds(),
microseconds=self.microsecond,
)