Skip to content

Instantly share code, notes, and snippets.

View wodCZ's full-sized avatar

Martin Janeček wodCZ

View GitHub Profile
<?php
/**
* Simple message queue implementation.
*/
class Extra_MessageQueue
{
private $maxRunTime;
private $startTime;
private $queue;

Keybase proof

I hereby claim:

  • I am wodcz on github.
  • I am wodcz (https://keybase.io/wodcz) on keybase.
  • I have a public key ASCttfDh5fWqmFvK8uLMo-lA1SqBz_qQojGYDnpLOa7mAAo

To claim this, I am signing this object:

@wodCZ
wodCZ / Dockerfile
Created February 4, 2018 14:38
django, postgres, redis, celery, nginx, uwsgi docker setup
FROM python:latest
ADD requirements.txt /requirements.txt
RUN python3.6 -m venv /venv \
&& /venv/bin/pip install -U pip \
&& LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "/venv/bin/pip install --no-cache-dir -r /requirements.txt"
ENV PYTHONUNBUFFERED 1
# Copy your application code to the container (make sure you create a .dockerignore file if any large files or directories should be excluded)
RUN mkdir /code/
@wodCZ
wodCZ / example.js
Created February 21, 2018 15:34
react native least PITA video
return (<WebView
style={{
width: '100%',
aspectRatio: this.state.videoConfig.aspectRatio,
}}
onError={() => this.setState({offline: true})}
source={{
html: `
<head>
@wodCZ
wodCZ / Dockerfile
Created March 20, 2018 13:39
production ready react docker multi-stage build with proper service-worker nginx configuration
FROM node:9.8.0-alpine as build
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn build
FROM nginx:1.13.9-alpine
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY --from=build /usr/src/app/build /usr/share/nginx/html
import logging
from celery.app.defaults import DEFAULT_TASK_LOG_FMT, DEFAULT_PROCESS_LOG_FMT
class CeleryTaskFilter(logging.Filter):
def filter(self, record):
return record.processName.find('Worker') != -1
@wodCZ
wodCZ / Dockerfile
Created February 13, 2019 14:28
Configuration for SPA frontend in Docker
FROM node:9.8.0-alpine as build
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn
COPY . ./
RUN yarn build
FROM nginx:1.13.9-alpine
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY --from=build /usr/src/app/build /usr/share/nginx/html
@wodCZ
wodCZ / async-foreach.ts
Last active November 21, 2019 13:36 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
export async function asyncForEach<T>(array: T[], callback: (item: T, index: number, allItems: T[]) => void) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
}
@wodCZ
wodCZ / express.js
Created March 17, 2020 18:47
Web Framework performance comparison
const express = require('express')
const app = express()
const port = 4000
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
// node express.js
@wodCZ
wodCZ / Metricbeat aws module permissions
Created May 28, 2020 08:44 — forked from asjadathick/Metricbeat aws module permissions
AWS IAM policy for metricbeat aws module metricsets
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DescribeRegions",
"cloudwatch:GetMetricData",