This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
from datetime import datetime, timedelta | |
# Days aged | |
DAYS_AGED = 30 | |
# token from https://api.slack.com/web | |
TOKEN = os.environ.get('SLACK_TOKEN') # set an env variable for slack token | |
ENDPOINT = 'https://slack.com/api/{}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def orders_report(request, company): | |
import cProfile | |
pr = cProfile.Profile() | |
pr.enable() | |
....code to profile | |
# stop profiling and output to console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models.functions import Lower | |
from django.db.models import CharField | |
from django.contrib.auth.models import UserManager as DjangoUserManager | |
CharField.register_lookup(Lower, 'lower') | |
class UserManager(DjangoUserManager): | |
""" | |
Allow case insensitive usernames for authenticating. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'formula' | |
class Geos < Formula | |
homepage 'http://trac.osgeo.org/geos' | |
url 'http://download.osgeo.org/geos/geos-3.4.2.tar.bz2' | |
sha1 'b8aceab04dd09f4113864f2d12015231bb318e9a' | |
option :universal | |
option :cxx11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
usage: python broken_links.py somedomain.com > broken_links.list | |
somedomain.com/sitemap.xml will be grabbed and parsed | |
for each location entry, the page is fetched and all links on that page | |
make a HEAD request. The output is a summary of broken links and what entries or locations | |
contained them from sitemap.xml | |
this offeres a crude but effective way to spot essential pages across a domain. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import datetime | |
from .hooks import auth_check | |
class Service: | |
""" Base Service Class """ | |
def __init__(self, username=None, password=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# _______ _______ _ _________ _ _______ | |
# |\ /|( ___ )( ____ )( ( /|\__ __/( ( /|( ____ \ | |
# | ) ( || ( ) || ( )|| \ ( | ) ( | \ ( || ( \/ | |
# | | _ | || (___) || (____)|| \ | | | | | \ | || | | |
# | |( )| || ___ || __)| (\ \) | | | | (\ \) || | ____ | |
# | || || || ( ) || (\ ( | | \ | | | | | \ || | \_ ) | |
# | () () || ) ( || ) \ \__| ) \ |___) (___| ) \ || (___) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# gunicorn.conf.py: getting gevent and gevent-psycopg2 running | |
bind = '127.0.0.1:1437' | |
accesslog = "<some-path>/logs/gunicorn-access.log" | |
errorlog = "<some-path>/logs/gunicorn-error.log" | |
workers = 5 | |
try: | |
# fail 'successfully' if either of these modules aren't installed | |
from gevent import monkey | |
import gevent_psycopg2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import template | |
register = template.Library() | |
class UpdateQuerystringNode(template.Node): | |
def __init__(self, **kwargs): | |
self.kwargs = kwargs | |
def render(self, context): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
lg = log --graph --oneline --decorate --all | |
today = log --since=midnight --pretty='format:%an @ %ad%n%Cblue%s%n' | |
add this to ~/.gitconfig | |
then go | |
$ git today |
NewerOlder