Skip to content

Instantly share code, notes, and snippets.

View alfakini's full-sized avatar

Alan R. Fachini alfakini

View GitHub Profile
NUMBER_OF_CORES=4
sudo apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev
sudo apt-get install -y --no-install-recommends libboost-all-dev
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y python-dev
sudo apt-get install -y python-pip git
sudo apt-get install -y libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler
# -*- encoding : utf-8 -*-
class AccountLogoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
if Rails.env.development? || Rails.env.test?
storage :file
else
storage :s3
s3_access_policy 'public-read'
end
@alfakini
alfakini / gist:a32b9bf3cc1e5c534e40
Created January 31, 2013 05:04
Using Scrapy to find wrong escaped html code on a Rails 2.3 app with rails_xss plugin installed.
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http.request import Request
class HomeSpider(BaseSpider):
name = "rails_xss"
root = "http://0.0.0.0:3000/"
start_urls = [root]
def parse(self, response):
@alfakini
alfakini / watcher.py
Created October 16, 2018 00:18
Filesystem events monitoring with Python [watcher.py]
import sys
import time
from watchdog.observers import Observer
from .events import ImagesEventHandler
class ImagesWatcher:
def __init__(self, src_path):
self.__src_path = src_path
self.__event_handler = ImagesEventHandler()

Keybase proof

I hereby claim:

  • I am alfakini on github.
  • I am alfakini (https://keybase.io/alfakini) on keybase.
  • I have a public key ASDKbWiwaCUJnq3RWVwqz3-aDkpboHOldbjGsrIvB6RqUwo

To claim this, I am signing this object:

@alfakini
alfakini / events.py
Last active August 15, 2021 05:40
Filesystem events monitoring with Python [events.py]
import os
from PIL import Image
from PIL.ImageOps import grayscale
from watchdog.events import RegexMatchingEventHandler
class ImagesEventHandler(RegexMatchingEventHandler):
THUMBNAIL_SIZE = (128, 128)
IMAGES_REGEX = [r".*[^_thumbnail]\.jpg$"]
def __init__(self):