Skip to content

Instantly share code, notes, and snippets.

View lucasvo's full-sized avatar

Lucas Vogelsang lucasvo

View GitHub Profile
from inspirator import subscriberservice
from inspirator.models import Subscriber, DeliveryPreference
from pytz import timezone
from datetime import datetime, timedelta
import unittest
from freezegun import freeze_time
class TestDetermineNextSendDate(unittest.TestCase):
tz = timezone('Europe/Zurich')
now = datetime.now(tz).replace(hour=9)
# This is an implementation using python-oembed with api.embed.ly
# python-oembed http://code.google.com/p/python-oembed/
import oembed
# Embed.ly Multi Provider API Endpoint
OEMBED_ENDPOINT = 'http://api.embed.ly/oembed/api/v1'
# URL Schemes Supported --- complete list maintained
# http://api.embed.ly/1/services/python
@lucasvo
lucasvo / queryset.coffee
Created August 24, 2012 07:09
Querysets in Backbone
define ['jquery', 'underscore', 'backbone'], ($, _, Backbone) ->
# The queryset iterator is a helper that builds iterator functions that allow simple string matching such as:
# sample_iterator = (model) ->
# return model.get(key) == value
class QuerysetIterator
constructor: (expressions) ->
@expressions = expressions
iterator: (model) ->
for key, value in @expressions
@lucasvo
lucasvo / gist:7200769
Created October 28, 2013 17:13
compileSass
MBLAV ➜ creamcheese (develop*) gradle watchSass
:installCompass UP-TO-DATE
:watchSass
BUILD SUCCESSFUL
Total time: 1.053 secs
MBLAV ➜ creamcheese (develop*) ps aux | grep sass
lucasvo 55333 2.5 0.6 3000824 107416 s001 S 10:09AM 0:04.70 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -client -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dfile.encoding=MacRoman -cp /Users/lucasvo/.gradle/caches/artifacts-26/filestore/org.jruby/jruby-complete/1.7.3/jar/2273e4c2a2abdd4b25a21bc513bfc05cfba31f3b/jruby-complete-1.7.3.jar org.jruby.Main -X-C -S compass watch --sass-dir /Users/lucasvo/Code/dundermifflin/creamcheese/src/scss --css-dir /Users/lucasvo/Code/dundermifflin/creamcheese/web-app/css/compiled --images-dir /Users/lucasvo/Code/dundermifflin/creamcheese/src/scss/sprites --app stand_alone --environment development --output-style compact --debug-info
lucasvo 55351 0.4 0.6 3001872 105904 s001 S 10:10AM 0:04.35 /System/Library/Java/JavaVirtualMachines
@lucasvo
lucasvo / sys.out.sh
Created November 11, 2013 21:05
gradle runRequireJS
...
13:01:07.494 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.JavaSystemPropertiesHttpProxySettings] Found java system property 'http.nonProxyHosts': local|*.local|169.254/16|*.169.254/16. Will ignore proxy settings for these hosts.
13:01:07.495 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.HttpClientConfigurer] Using Credentials [username: reader] and NTLM Credentials [user: reader, domain: , workstation: MBLAV] for authenticating against 'null:-1'
13:01:07.497 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.memcache.InMemoryDependencyMetadataCache] Reusing in-memory cache for repo 'maven5' [25c6b342e2c18a4d2edfaf79658d6b1f].
13:01:07.501 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting configuration com.jam:loginApp:0.1(rhino).
13:01:07.502 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting dependency com.jam:loginApp:0.1(rhino) -> org.mozilla:rhino:1.
@lucasvo
lucasvo / .zshrc.sh
Created August 2, 2012 18:09
Automatically activate your python virtualenvironment
function auto_activate {
SEARCHPATH=`pwd`
function activate_env {
# ZSH outputs errors for the ls * command if you don't disable the nomatch output
unsetopt nomatch 2>/dev/null
ls $SEARCHPATH/*/bin/activate > /dev/null 2> /dev/null
if [ "$?" = '0' ]; then
deactivate > /dev/null 2> /dev/null
@lucasvo
lucasvo / CLA.md
Last active April 3, 2018 23:24
Centrifuge CLA

Centrifuge Individual Contributor License Agreement

This CLA is taken from http://harmonyagreements.org

Thank you for your interest in contributing to Centrifuge ("We" or "Us"). This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us by electronic submission, following the instructions at github pull request. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.

1. Definitions

"You" means the individual who Submits a Contribution to Us.

@lucasvo
lucasvo / example.go
Last active April 23, 2018 20:25
Precise Proofs Example
// ExampleDocument is a protobuf message
document := documents.ExampleDocument{
Value1: 1,
ValueA: "Foo",
ValueB: "Bar",
ValueBytes1: []byte("foobar"),
}
// The FillSalts method is a helper function that fills all fields with 32
// random bytes. SaltedExampleDocument is a protobuf message that has the
### Keybase proof
I hereby claim:
* I am lucasvo on github.
* I am lucasvo (https://keybase.io/lucasvo) on keybase.
* I have a public key ASDRA1cQdlFqOFA0k_3f3J33S0lzuaX7opUjcsTufqtQ0wo
To claim this, I am signing this object:
@lucasvo
lucasvo / nft.code.py
Last active July 16, 2019 17:10
Centrifuge ZK NFT Demo
# See: https://github.com/centrifuge/zk-nft-demo-contract/blob/5ef74b64a9500937a26a0a3abc4db7539c39c2b8/src/circuit/nft.code#L45-L82
def main(field[2] creditRatingRootHashField, field buyerRatingField, privatefield[160] buyerID, privatefield[256] buyerPubkey, privatefield[2] directionCreditRatingTree, privatefield[256] creditRatingTreeDigest0, privatefield[256] creditRatingTreeDigest1, field nftAmount, field[2] documentRootHashField, privatefield[256] invoiceAmountValue, privatefield[64] invoiceAmountProperty, privatefield[256] invoiceAmountSalt, privatefield[8] invoiceAmountTreeDirection, privatefield[256] invoiceAmountTreeDigests0, privatefield[256] invoiceAmountTreeDigests1, privatefield[256] invoiceAmountTreeDigests2, privatefield[256] invoiceAmountTreeDigests3, privatefield[256] invoiceAmountTreeDigests4, privatefield[256] invoiceAmountTreeDigests5, privatefield[256] invoiceAmountTreeDigests6, privatefield[256] invoiceAmountTreeDigests7, privatefield[160] invoiceBuyerValue, privatefield[64] invoiceBuyer