Skip to content

Instantly share code, notes, and snippets.

Living life

Brice Leroy debrice

Living life
View GitHub Profile
debrice / Flask-SQLAlchemy
Last active Aug 21, 2020
Flask SQLAlchemy Caching
View Flask-SQLAlchemy

Flask-SQLAlchemy Caching

The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.


retrieve one object

# pulling one User object
user = User.query.get(1)
View index.html
html {
font-family: sans-serif;
code {
background-color: #333333;
color: #dddddd;
padding: 4px 8px;
debrice / fromModule.js
Last active Jul 9, 2020
Create a feature folder from an existing feature folder
View fromModule.js
#!/usr/bin/env node
// this is to use when you duplicate a module.
// For example, lets say you have all the crud basic feature for "user"
// and you would like to seed the feature "product" with it.
// You'll have to copy "user" into "product", search and replace every instance
// of user and replace them into "product"...
// and "User" into "Product"...
// and "USER" into "PRODUCT"...
// and rename all the files.. include into
debrice /
Last active May 25, 2020
Simple Website Crawler (in python)

Simple Website Crawler

The following gist is an extract of the article Building a simple crawler. It allows crawling from a URL and for a given number of bounce.

Basic Usage

from crawler import Crawler
crawler = Crawler()
# displays the urls
debrice / devices.html
Last active May 2, 2020
Device test webpage - a la sizzy
View devices.html
<!DOCTYPE html>
body {
background-color: aliceblue;
debrice / multiples.js
Created Feb 2, 2020
Simpler solution of the iterative method
View multiples.js
function sumMultiples(n, mul){
var sum=0;
for (var i = 0 ; i < n ; i = mul + i) {
sum += i;
return sum;
console.log(sumMultiples(1000, 5) + sumMultiples(1000, 3) - sumMultiples(1000, 15));
debrice /
Last active Jan 30, 2018
Detecting Similar News

Detecting Similar News

The following gist is an extract of the article Detecting Similar News. It exploit data retrieve by a crawler and detect similar article across different domains


Start by running the crawler to retrieve the data. Crawler takes about 50 minutes to retrieve all the data the first time.

$ python
retrieving url... [] /
View WebSocket.js
import { Component } from "react";
import { connect } from "react-redux";
import { getTicket, getAssignedTickets } from "../../actions";
import { getJWToken } from "../../middleware/api";
class Socket extends Component {
getWebsocketServerLocation() {
const host =*/, "");
return "ws://" + host + ":8010";
debrice /
Last active Jun 27, 2017
Lambda function name error

Hey guys,

I've suddenly (around 11:30am Pacific) been getting this error on every single one of my API gateway -> lambda calls. I'm using Terraform and Apex to manage my deployment. This happened after my latest deployment. No changes to my method names occurred. Also, I've tested the ARN versus the RegExp your error mentions and it actually matches:


{"message": "1 validation error detected: Value \'arn:aws:lambda:us-east-1:347978430301:function:arn:aws:lambda:us-east-1:347978430301:function:experiment_stamps\' at \'functionName\' failed to satisfy constraint: Member must satisfy regular expression pattern: (arn:(aws|aws-us-gov):lambda:)?([a-z]{2}(-gov)?-[a-z]+-\\d{1}:)?(\\d{12}:)?(function:)?([a-zA-Z0-9-_\\.]+)(:(\\$LATEST|[a-zA-Z0-9-_]+))?"}
Tue Jun 27 19:12:08 UTC 2017 : Endpoint response body before transformations: {"message":"1 validation error detected: Value 'arn:aws:lambda:us-east-1:347978430301:function:arn:aws:lambda:us-east-1:347978430301:function:experiment_notifications' at 'fu