Skip to content

Instantly share code, notes, and snippets.

View jgsogo's full-sized avatar
🦄
New times ahead

Javier G. Sogo jgsogo

🦄
New times ahead
View GitHub Profile
@jgsogo
jgsogo / .gitignore
Last active August 29, 2015 14:21 — forked from crizCraig/gist:2816295
*.pyc
@jgsogo
jgsogo / apicultur_io_example.py
Last active August 29, 2015 14:25
Using 'apicultur-python' to call an API at http://apicultur.io
import sys
from distutils.version import LooseVersion, StrictVersion
from apicultur import Apicultur, __version__ as apiculture_version
if not LooseVersion(apiculture_version) >= LooseVersion("0.1.5"):
print(u"Upgrade apicultur library with 'pip install apicultur --upgrade'")
sys.exit(1)
ACCESS_TOKEN = 'your-access-token'
== CPython 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)]
== Windows-7-6.1.7601-SP1 little-endian
== hash algorithm: siphash24 64bit
== C:\Users\<me>\AppData\Local\Temp\test_python_7576
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
[ 1/390] test_grammar
[ 2/390] test_opcodes
[ 3/390] test_dict
[ 4/390] test_builtin
[ 5/390] test_exceptions
@jgsogo
jgsogo / LimitedAdminInlineMixin.py
Created February 3, 2012 19:43 — forked from dokterbob/admin.py
InlineAdmin mixin limiting the selection of related items according to criteria which can depend on the current parent object being edited.
import logging
logger = logging.getLogger('commerce')
class LimitedAdminInlineMixin(object):
"""
InlineAdmin mixin limiting the selection of related items according to
criteria which can depend on the current parent object being edited.
A typical use case would be selecting a subset of related items from
other inlines, ie. images, to have some relation to other inlines.
@jgsogo
jgsogo / __init__.py
Created March 20, 2012 12:14
Django templatetags mixins
from dictnode import *
def get_cleaned_bbcode(self):
"""
returns a cleaned version of the self.text bbcode.
"""
if self.bbcode_bitfield:
bbcode_uid = self.bbcode_uid
else:
bbcode_uid = None
properUTF8string = unicode(self.text, 'utf-8')
@jgsogo
jgsogo / eol2-search_engine.py
Created November 19, 2015 23:00
Naïve search engine implementation
# -*- coding: utf-8 -*-
# Naïve search engine implementation done as example for @lingwars meeting
print("============================")
print("=== Mi motor de búsqueda ===")
print("============================")
print("\n")
# Creamos nuestra base de datos
@jgsogo
jgsogo / blockchain.md
Created April 23, 2017 17:56 — forked from anhldbk/blockchain.md
Blockchain applications

What are non-Bitcoin applications of blockchain technology?

"In 2015 Uber, the world's largest taxi company owns no vehicles, Facebook the world's most popular media owner creates no content, Alibaba the most valuable retailer has no inventory, and Airbnb the world's largest accommodation provider owns no real estate."*

Through collaboration and value distribution, decentralized autonomous organizations (DAOs) will be just as disruptive to the above centralized business models.

Currency

@jgsogo
jgsogo / mass_mail.py
Last active October 2, 2017 12:30
Send mass mail using GMail
import os
import sys
import logging
from send_mail import gmail_send
log = logging.getLogger(__name__)
_LOG_LEVEL_STRINGS = ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG']
@jgsogo
jgsogo / conanfile.py
Last active September 26, 2018 09:01
Conan options truth tables
# Not a valid Conan (http://conan.io) recipe, just some lines of code to test option evaluation.
from conans import ConanFile, CMake, tools
from conans.errors import ConanException
def try_option_boolean(pkg_option, lambda_cmp):
try:
return "{}".format(lambda_cmp(pkg_option))