>>> import base64
>>> data = '{"u": "test"}'
>>> code = base64.b64encode(data)
>>> code
'eyJ1IjogInRlc3QifQ=='
""" | |
Minecraft Server Log Time Spent Ranking | |
""" | |
__author__ = 'Gavin M. Roy' | |
__email__ = '[email protected]' | |
__since__ = '2012-01-05' | |
import datetime | |
import operator |
// gcc -O2 -Wall -pedantic process-mysqldump.c -o process-mysqldump | |
// Usage: cat dump.sql | process-mysqldump | |
// Or : process-mysqldump dump.sql | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdbool.h> | |
#include <string.h> | |
#define BUFFER 100000 |
This tutorial will turn your Raspberry PI into a simple Bluetooth audio receiver, which plays music through connected speakers. It's like a regular car audio system, but it can be used anywhere and it's a good value.
Audio source (i.e. smartphone)
|
v
((( Wireless Bluetooth Channel )))
|
#!/bin/bash | |
# | |
# This script surrounds the command passed in with start and finish notifications | |
# to the cronitor monitoring application. | |
# | |
# === SETUP | |
# | |
# * Make sure the cronitor script is executable. | |
# | |
# chmod +x cronitor |
Benchmark results: | |
Date: 2016/03/20 | |
Version: asgi_redis 0.8.3 / daphne master / channels master / cpython 2.7.11 | |
Environment: AWS, 3x m3.large (1 daphne, 1 worker, 1 redis) | |
Source: 1x m3.medium, different AZ, ab for HTTP, channels benchmarker for WS | |
HTTP GET, Django View (concurrency 10, 10,000 total) | |
Failures: 0.0% | |
Rate: 160 req/s |
type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
from django.db.models import CharField | |
from django.core.exceptions import ImproperlyConfigured | |
from django.utils.translation import ugettext_lazy as _ | |
class NullCharField(CharField): | |
""" | |
Subclass of the CharField that allows | |
empty strings to be stored as NULL in database | |
""" |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.