Skip to content

Instantly share code, notes, and snippets.

View miguelgarcia's full-sized avatar
Working from home

Miguel Garcia miguelgarcia

Working from home
View GitHub Profile
@miguelgarcia
miguelgarcia / main.py
Created September 28, 2019 16:11
Script to unmute all muted accounts in twitter
import tweepy
# Install tweepy with `pip3 install tweepy`
# See https://realpython.com/twitter-bot-python-tweepy/ for info about how to generate credentials
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
@miguelgarcia
miguelgarcia / factories.py
Last active June 5, 2024 22:53
Python: factoryboy + sqlalchemy. SubFactory and RelatedFactory example
# factories
class CategoryFactory(factory.alchemy.SQLAlchemyModelFactory):
class Meta:
model = models.Category
sqlalchemy_session = db.session
sqlalchemy_session_persistence = 'commit'
name = factory.Sequence(lambda n: u'Category %d' % n)
class CompanyFactory(factory.alchemy.SQLAlchemyModelFactory):
@miguelgarcia
miguelgarcia / weights.py
Last active October 2, 2018 23:13
For each row apply a different weight to each column
import numpy
data = numpy.array(
[
[1,2,3,4],
[5,6,7,8],
[9,10,11,12],
]
)