Skip to content

Instantly share code, notes, and snippets.

from celery import shared_task
@shared_task(bind=True)
def cute_task(self, filters=None):
if filters is None:
filters = {}
for x in range(0, 10):
print(filters)
filters[str(uuid.uuid4())] = str(uuid.uuid4())
raise self.retry()
type Node interface {
Prepare()
Run()
}
func doSomeWork(n Node) {
// ...
n.Prepare()
// ...
n.Run()
from sanic import Sanic
from sanic.response import json
from prometheus_client import Counter
from sanic_prometheus import monitor
c1 = Counter('simple_counter', "Just simple counter")
app = Sanic("snippet")
monitor(app).expose_endpoint()
class C1:
def __init__(self, obj):
self.obj = obj
def __getattr__(self, name):
if hasattr(self.obj, name):
return getattr(self.obj, name)
def t1(self):
import java.lang.Math;
import java.util.function.BinaryOperator;
import java.io.*;
// one class needs to have a main() method
public class Test
{
// arguments are passed using the text field below this editor
@SirEdvin
SirEdvin / .bumpversion.cfg
Last active July 20, 2017 14:28
Bumpversion example configuration
[bumpversion]
current_version = 0.1.0
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<pre>[a-z]+)\.(?P<prenum>\d+))?
serialize =
{major}.{minor}.{patch}-{pre}.{prenum}
{major}.{minor}.{patch}
[bumpversion:file:test.txt]
[bumpversion:part:pre]
@SirEdvin
SirEdvin / gist:180ef01a68f97d1c191fc9e736e7e5dd
Created June 21, 2017 08:35 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
server 172.158.0.0 255.255.0.0
verb 3
key ...
ca ..
cert ...
dh ...
tls-auth ...
key-direction 0
keepalive 10 60
persist-key
server {
listen 80;
server_name _;
rewrite ^ https://$http_host$request_uri? permanent; # force redirect http to https
}
server {
listen 443;
ssl on;
ssl_certificate /path/to/ssl;

Keybase proof

I hereby claim:

  • I am siredvin on github.
  • I am siredvin (https://keybase.io/siredvin) on keybase.
  • I have a public key ASCDaHEVQdMiFyMPVPwI-ul1uJpO5NTKc6QQsL62Mzk97Ao

To claim this, I am signing this object: