Skip to content

Instantly share code, notes, and snippets.

View cstrap's full-sized avatar
🐍

Christian Strappazzon cstrap

🐍
View GitHub Profile
@cstrap
cstrap / django_haystack_testing.py
Last active September 14, 2018 13:07 — forked from justquick/django_haystack_testing
Django haystack testing index
import haystack
from django.core.management import call_command
from django.test.utils import override_settings
TEST_INDEX = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
@cstrap
cstrap / introrx.md
Created October 16, 2015 16:09 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@cstrap
cstrap / search.py
Created November 9, 2015 11:37 — forked from frague59/search.py
search features with attachment supports
# -*- coding: utf-8 -*-
"""
Search features for an elasticsearch / haystack / elasticstack
:creationdate: 05/11/15 15:05
:moduleauthor: François GUÉRIN <[email protected]>
:modulename: intrautils.search
"""
import base64
@cstrap
cstrap / bobp-python.md
Created November 17, 2015 08:29 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@cstrap
cstrap / Vagrantfile
Created March 7, 2016 17:43 — forked from gabrielelana/Vagrantfile
How to create a VirtualBox machine with encrypted storage with Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
PASSWORD_PATH = ".password"
PASSWORD_ID_PATH = ".password_id"
# Make sure to have installed vagrant-triggers plugin
# > vagrant plugin install vagrant-triggers
# After the first `vagrant up` stop the VM and execute the following steps
@cstrap
cstrap / sudo.py
Created April 21, 2016 09:46 — forked from barneygale/sudo.py
import sys, marshal, functools, subprocess
child_script = """
import marshal, sys, types;
fn, args, kwargs = marshal.load(sys.stdin)
marshal.dump(
types.FunctionType(fn, globals())(*args, **kwargs),
sys.stdout)
"""
@cstrap
cstrap / data-uri.py
Created June 6, 2016 16:19 — forked from jsocol/data-uri.py
Give an image, get a data-uri
#!/usr/bin/env python
"""Command line script to convert a file, usually an image, into a data URI
for use on the web."""
import base64
import mimetypes
import os
import sys
@cstrap
cstrap / sample_usage.py
Created June 23, 2016 13:00 — forked from luke14free/sample_usage.py
Simple type checked objects in Python
#!/usr/bin/env python
from type_checked_entities import entity_factory
Giraffe = entity_factory( # let's define what is a giraffe!
"giraffe",
name=str, # my name is a string
age=float, # my age is an int
eats=object, # I eat pretty much everything.
)
@cstrap
cstrap / slack_deploy_bot_template.py
Created August 23, 2016 09:49 — forked from achauve/slack_deploy_bot_template.py
Template of Slack bot for deployment
import logging
import os
import time
import traceback
# pip install slackclient
from slackclient import SlackClient
@cstrap
cstrap / progressive-ace.htm
Created February 3, 2017 17:05 — forked from duncansmart/progressive-ace.htm
Integrating ACE Editor in a progressive way
<textarea name="my-xml-editor" data-editor="xml" rows="15"></textarea>
...
<textarea name="my-markdown-editor" data-editor="markdown" rows="15"></textarea>
...
<script src="//d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
<script>
// Hook up ACE editor to all textareas with data-editor attribute
$(function () {