Skip to content

Instantly share code, notes, and snippets.

View quamilek's full-sized avatar

Kamil Warguła quamilek

  • Allegro Group
  • Poznań, Poland
View GitHub Profile
FROM alpine:latest AS build
RUN apk add --no-cache alpine-sdk
RUN git clone https://github.com/tcastberg/wmbusmeters.git
WORKDIR /wmbusmeters
RUN make
FROM alpine:latest as scratch
ENV QEMU_EXECVE=1
RUN apk add --no-cache mosquitto-clients libstdc++
WORKDIR /wmbusmeters
@janisz
janisz / bigcache bench test .tsv
Last active July 7, 2016 22:21
go version go1.6.2 linux/amd64 vs. go version go1.7beta2 linux/amd64
benchmark go1.6.2 ns/op go1.7beta2 ns/op delta
BenchmarkWriteToCacheWith1Shard-4 3106 2714 -12.62%
BenchmarkWriteToLimitedCacheWithSmallInitSizeAnd1Shard-4 3102 1885 -39.23%
BenchmarkWriteToUnlimitedCacheWithSmallInitSizeAnd1Shard-4 10277 5652 -45.00%
BenchmarkWriteToCacheWith512Shards-4 1190 976 -17.98%
BenchmarkWriteToCacheWith1024Shards-4 1320 1006 -23.79%
BenchmarkWriteToCacheWith8192Shards-4 1290 1053 -18.37%
BenchmarkWriteToCacheWith1024ShardsAndSmallShardInitSize-4 1359 1090 -19.79%
BenchmarkReadFromCacheWith1024Shards-4 693 606 -12.55%
BenchmarkReadFromCacheWith8192Shards-4 714 606 -15.13%
@olliebun
olliebun / test_asyncio.py
Last active March 7, 2023 09:32
Simple python asyncio example.
"""
This program defines a run_all function which will retrieve two
URLs and run a shell subcommand, all concurrently, using asyncio.
What stands out in this example is the readability of the get() and cmd()
functions, and the usefulness of asyncio.gather().
An excerpt from the program output shows the way they are interleaved:
Start: http://google.com
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active July 4, 2024 17:31
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@majek
majek / udp_server.py
Created February 8, 2012 00:48
Simple python udp server
import logging
import socket
log = logging.getLogger('udp_server')
def udp_server(host='127.0.0.1', port=1234):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@abhin4v
abhin4v / echo-server.py
Created May 24, 2011 08:49
A simple echoing HTTP server with HTTP-Basic-Auth in Python Flask
from functools import wraps
from flask import Flask, request, Response
app = Flask(__name__)
def check_auth(username, password):
"""This function is called to check if a username /
password combination is valid.
"""
return username == 'username' and password == 'pass'