Skip to content

Instantly share code, notes, and snippets.

View BenAtWide's full-sized avatar
🌇
Skiff

Ben Edwards BenAtWide

🌇
Skiff
View GitHub Profile
@BenAtWide
BenAtWide / apache-basic-auth
Created July 17, 2012 14:17 — forked from lurcio/apache-basic-auth
Apache 2.2 Basic Authentication
AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile /path/to/password/file
Require user valid-user
@BenAtWide
BenAtWide / gist:3339902
Created August 13, 2012 11:41 — forked from axelav/gist:1839777
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@BenAtWide
BenAtWide / gist:3414921
Created August 21, 2012 12:00 — forked from pioz/gist:403496
Adding system user, e.g. to run redis
adduser --system --no-create-home --group --shell /bin/false --disabled-password --disabled-login redis
"""
Backbone.js handler and mongodb based handler for Tornado.
`BackboneHandler` handles the sync protocol for Backbone.js. Inherit
from the class and implement the model methods:
* create_model
* update_model
* get_model
* delete_model
* get_collection
#!/usr/bin/env python
#
# Very simple Python script to dump all emails in an IMAP folder to files.
# This code is released into the public domain.
#
# RKI Nov 2013
#
import sys
import imaplib
import getpass
@BenAtWide
BenAtWide / export_issues.py
Created September 16, 2016 10:21 — forked from reberhardt7/export_issues.py
Github Issues Export: This script exports all issues from a repository, along with comments and events, into a JSON file. It also produces a Markdown file that can be used to easily view the issues.
"""
This script uses Github's API V3 with Basic Authentication to export issues from
a repository. The script saves a json file with all of the information from the
API for issues, comments, and events (on the issues), downloads all of the
images attached to issues, and generates a markdown file that can be rendered
into a basic HTML page crudely mimicking Github's issue page. If the gfm module
is available, the script will go ahead and render it itself.
In the end, you'll be left with a folder containing a raw .json file (which you
can use to extract information for your needs, or to import it somewhere else),
content_type = ContentType.objects.get(app_label='', model='')
#get all permssions for this model
perms = Permission.objects.filter(content_type=content_type)
group = Group.objects.get(name='')
for p in perms:
group.permissions.add(perms)