Skip to content

Instantly share code, notes, and snippets.

View AlexNeises's full-sized avatar

Alex Neises AlexNeises

View GitHub Profile
@AlexNeises
AlexNeises / app.coffee
Last active March 15, 2020 03:43
Google Analytics real time dashboard via Node.js
DEVICES = 1000 * 15 # Only call the API once every 15 seconds.
path = require 'path'
google = require 'googleapis'
key = require './config/analytics.json' # This is the key Google Developer has you download upon service account creation.
express = require 'express'
http = require 'http'
https = require 'https'
analytics = google.analytics 'v3'
@AlexNeises
AlexNeises / skrapr.py
Created February 28, 2017 23:04
A python script to go through a list of subreddits, grab the hot 25 threads of each one, and crawl every comment with positive karma, while creating a json list of users who met the criteria.
import praw
client_id = 'XXXXXXXX'
client_secret = 'XXXXXXXX'
refresh_token = 'XXXXXXXX'
reddit = praw.Reddit(client_id=client_id, client_secret=client_secret, refresh_token=refresh_token user_agent='Skrapr')
crawl_subreddits = ['sub1', 'sub2', 'sub3']
@AlexNeises
AlexNeises / watermark.py
Created September 22, 2016 18:59
Adding a repeating watermark to an image using Python and Pillow
from PIL import Image
def create_watermark(image_path, final_image_path, watermark, hires=False):
main = Image.open(image_path)
mark = Image.open(watermark)
mark = mark.rotate(30, expand=1)
mask = mark.convert('L').point(lambda x: min(x, 25))
mark.putalpha(mask)
mark_width, mark_height = mark.size
main_width, main_height = main.size