Skip to content

Instantly share code, notes, and snippets.

Victor Carriço Santos victorcarrico

Block or report user

Report or block victorcarrico

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
victorcarrico /
Created Dec 4, 2018
Celery Canvas: It's basically the inverse chord which is like a map_reduce. This run a task and with the result run a celery group with the results.
from celery import task, subtask, group
def get_list(amount):
return [i for i in range(amount)]
def process_item(item):
# do stuff
victorcarrico /
Last active Dec 13, 2018
Easy Line Profile Example
from line_profiler import LineProfiler
import random
def do_stuff(numbers):
s = sum(numbers)
l = [numbers[i]/43 for i in range(len(numbers))]
m = ['hello'+str(numbers[i]) for i in range(len(numbers))]
numbers = [random.randint(1,100) for i in range(1000)]
lp = LineProfiler()
victorcarrico /
Created Apr 29, 2017
Send a message to a group of Instagram users (using instagram-python)
from InstagramAPI import Instagram
def get_user_info_and_login():
username = raw_input('Your Instagram username:\n')
password = raw_input('Your Instagram password:\n')
print 'Wait a second, logging in your account.\n'
api = Instagram(username, password)
victorcarrico / password_validators.js
Created Feb 2, 2017
Django password validators in javascript
View password_validators.js
import difflib from 'difflib';
// Password Validation
export function userAttributeSimilarityValidator(password, attributes) {
const DEFAULT_USER_ATTRIBUTES = ['first_name', 'last_name', 'email'];
const max_similarity = 0.7;
for (let user_attr of DEFAULT_USER_ATTRIBUTES) {
victorcarrico /
Created Aug 12, 2016
Nude detection algorithm with Python and OpenCV using Bag-of-Visual-Features.
# coding: utf-8
import cv
import cv2
import numpy as np
from sklearn.cluster import KMeans
class BoVF(object):
victorcarrico /
Last active Jan 18, 2017
Django REST Framework - Testing image upload
import tempfile
from PIL import Image
class PhotoCreateAPIViewTest(TestCase):
def setUp(self):
self.tmp_file = tempfile.NamedTemporaryFile(suffix='.jpg')
image ='RGB', (100, 100))
You can’t perform that action at this time.