Skip to content

Instantly share code, notes, and snippets.

Always down for Django!

Marc datamafia

Always down for Django!
Block or report user

Report or block datamafia

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
datamafia / simple_allow_all.xml
Created May 23, 2019 — forked from philfreo/simple_allow_all.xml
AWS S3 CORS policy examples
View simple_allow_all.xml
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="">
View cutsom_appl.php
// Session may not be started on this script, if not init session
if (!session_id()) {
// double check, once for the key, again that the result is an int larger than 0 (as WP will follow the AI rule in the DB)
if (array_key_exists('some_custom_var', $_SESSION) and $_SESSION['some_custom_var'] > 0){
echo 'User is valid with id:'.$_SESSION['some_custom_var'];
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
datamafia / cobra.txt
Created Apr 11, 2016
Every Cobra Motor model and KV I could Find on
View cobra.txt
Cobra CM-2204/28 Multirotor Motor, Kv=2300
Cobra C-2202/70 Brushless Motor, Kv=1530
Cobra C-2203/28 Brushless Motor, Kv=2800, E36-F1S
Cobra C-2203/34 Brushless Motor, Kv=2300
Cobra C-2203/46 Brushless Motor, Kv=1720
datamafia /
Created Apr 3, 2016
3 April NPR Sunday Puzzle Solution Kata
# source
def prepare_for_api(str_json):
Prepare a json string API use by escaping double quotes and removing \n new line breaks
:param str_json: string
:return: string
Note: Use pattern is to wrap data at the last possible moment to avoid extra escaping.
str_json = re.sub(' +', ' ', str_json) # kills multi whitespace
str_json = str_json.replace('\n', '') # kill new line breaks caused by triple quoted raw strings
str_json = str_json.replace('"', '\\"') # address double quotes
datamafia /
Created Jan 27, 2016
Looking for element in tuple inside list via len() as a boolean. Too cool to forget.
t = [
('a', 'b'),
('c', 'd')
if len([item[1] for item in t if item[0] == 'a']):
print 'yes'
print 'no'
# yes
if len([item[1] for item in t if item[0] == 'e']):
datamafia /
Created Jan 6, 2016 — forked from SpotlightKid/
Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Encrypt/decrypt files with symmetric AES cipher-block chaining (CBC) mode.
File Encryption: [-f] infile [outfile]
datamafia / 0_reuse_code.js
Created Jan 3, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
datamafia /
Created Nov 13, 2015 — forked from sloria/
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


  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
You can’t perform that action at this time.