Skip to content

Instantly share code, notes, and snippets.

@smetj
smetj / validate
Created January 13, 2019 11:56
Creating a CLI tool using TermFunk
#!/usr/bin/env python
from termfunk import TermFunk
from termfunk import File
class Validate(TermFunk):
def __init__(self, description):
TermFunk.__init__(self, description, width=999)
Hello {{ something }}
I'm really glad you're trying out Templ8 a template rendering service!
For more information about the Jinja2 templating engine please visit:
http://jinja.pocoo.org/docs/2.10/templates/
Send your questions to templ8@smetj.net
Happy templating
{% set a = ["x"] %}
{% for item in a %}
{{ a.append("x") }}
{% endfor %}
@smetj
smetj / hello_world.tmpl
Created July 8, 2018 09:43
Jinja2 hello world template
Hello world to {{name}}
@smetj
smetj / bootstrap.yaml
Created April 22, 2018 13:52
Building a notification system part 3: Dropbox
protocols:
json_decode:
protocol: wishbone.protocol.decode.json
arguments:
buffer_size: 16777216
json_encode:
protocol: wishbone.protocol.encode.json
modules:
incoming_webhooks:
@smetj
smetj / bootstrap.yaml
Last active April 8, 2018 12:46
Building a notification system part 2: Integrating Travis
protocols:
json_decode:
protocol: wishbone.protocol.decode.json
arguments:
buffer_size: 16777216
json_encode:
protocol: wishbone.protocol.encode.json
modules:
incoming_webhooks:
@smetj
smetj / Dockerfile
Last active April 2, 2018 09:18
Files required for article https://smetj.net
FROM smetj/wishbone:latest
MAINTAINER Jelle Smet
RUN LC_ALL=en_US.UTF-8 /usr/bin/pip3 install --process-dependency-link https://github.com/smetj/wishbone/archive/master.zip
RUN LC_ALL=en_US.UTF-8 /usr/bin/pip3 install --process-dependency-link https://github.com/wishbone-modules/wishbone-input-httpserver/archive/master.zip
RUN LC_ALL=en_US.UTF-8 /usr/bin/pip3 install --process-dependency-link https://github.com/wishbone-modules/wishbone-output-twitter/archive/master.zip
@smetj
smetj / queue_vs_channel.py
Created February 28, 2018 14:21
A superficial test to see if there is any difference between Gevent Queue and Channel
#!/usr/bin/python
from testlap import TestLap
from gevent.queue import Queue, Channel
from gevent.pool import Pool
from gevent import sleep
class QueueVSChannel():
'''
@smetj
smetj / bootstrap_1.yaml
Last active February 25, 2018 12:05
An introduction to the wishbone-input-httpserver module
protocols:
json:
protocol: wishbone.protocol.decode.json
modules:
input:
module: wishbone_contrib.module.input.httpserver
protocol: json
red:
@smetj
smetj / graphite-carbon-cache
Created November 4, 2017 23:26
Docker image builds for Graphite
FROM centos:centos7
MAINTAINER Jelle Smet
EXPOSE 2003 2004 7002
RUN yum -y install python-devel cairo-devel libffi-devel wget gcc gcc-c++ python-dev bzip2 python-devel
RUN wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py && python /tmp/get-pip.py
RUN export PYTHONPATH="/opt/graphite/lib/:/opt/graphite/webapp/";pip install --no-binary=:all: https://github.com/graphite-project/whisper/tarball/master
RUN export PYTHONPATH="/opt/graphite/lib/:/opt/graphite/webapp/";pip install --no-binary=:all: https://github.com/graphite-project/carbon/tarball/master
VOLUME /usr/storage/whisper
CMD /usr/bin/carbon-cache.py start --nodaemon