Skip to content

Instantly share code, notes, and snippets.

View mattss's full-sized avatar

Matthew Sital-Singh mattss

View GitHub Profile
@mattss
mattss / testemail.py
Created February 23, 2021 14:44
Python email testing
from email.MIMEText import MIMEText
import smtplib
username = ''
password = ''
server = ''
fromaddr = ''
port = 587
fromemail = ''
@mattss
mattss / aws-s3-policy.json
Last active February 3, 2021 10:56
AWS policy for S3 read/write bucket access
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action":[
"s3:ListBucket"
],
"Resource":"arn:aws:s3:::mybucket"
},
rsync -r --update "/Users/cothamvisualsmacbook/Documents/ProPresenter6/" "/Users/cothamvisualsmacbook/Dropbox (City Church Bristol)/Sunday Visuals Share/propresenter_backups/Cotham/__Documents/Default/"
rsync -r --update "/Users/cothamvisualsmacbook/Library/Application Support/RenewedVision/ProPresenter6/Playlists/" "/Users/cothamvisualsmacbook/Dropbox (City Church Bristol)/Sunday Visuals Share/propresenter_backups/Cotham/__Playlist_Data/"
@mattss
mattss / plone_list_large_files.py
Last active November 28, 2018 11:12
List large files from Plone catalog
catalog = context.portal_catalog
fromdate = DateTime(2017, 1, 1)
lower = 50
brains = catalog.searchResults(meta_type='File', modified=fromdate, modified_range='max')
filedata = []
total = 0
for brain in list(brains):
sizestring = brain['getObjSize'].lower()
@mattss
mattss / screenshot.js
Created September 19, 2018 08:58
PhantomJS Screenshot Web Page
var system = require('system');
var url = system.args[1];
var page = require('webpage').create();
page.open(url, function(status) {
if ( status === "success" ) {
page.render('page.pdf');
phantom.exit();
}
});
@mattss
mattss / .Django-Quickstart.txt
Last active April 13, 2018 14:47
Django Quickstart
Django Quickstart
Usage:
# Download gist
wget -O dj.zip https://gist.github.com/mattss/7958b0cf91dd0715e554730cb14baff5/archive/master.zip
# Unzip (ignoring paths)
unzip -j dj.zip

Keybase proof

I hereby claim:

  • I am mattss on github.
  • I am mattss (https://keybase.io/mattss) on keybase.
  • I have a public key ASBp1rMf6FbmYveN6E6TZDaIdtu1rnknRVBsBZz1-sZOFQo

To claim this, I am signing this object:

@mattss
mattss / .emacs-custom.el
Created August 22, 2016 09:25
emacs TIDE setup
;;; tide setup
;;; https://github.com/ananthakumaran/tide/blob/master/README.md
(require 'tide)
(defun setup-tide-mode ()
"Set up tide mode."
(interactive)
(tide-setup)
(flycheck-mode +1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManager import setSecurityPolicy
from Products.CMFCore.tests.base.security import PermissiveSecurityPolicy, OmnipotentUser
_policy=PermissiveSecurityPolicy()
_oldpolicy=setSecurityPolicy(_policy)
newSecurityManager(None, OmnipotentUser().__of__(app.acl_users))
from Testing.makerequest import makerequest
try:
from zope.component.hooks import setSite
@mattss
mattss / zmi.conf
Last active October 13, 2015 09:25
ZMI access block
RewriteRule ^(.*)manage(_(?!translations).*)$ - [L,NC]
<LocationMatch "^/(manage|manage_main|(.*)/manage(_(?!translations).*))$" >
Order deny,allow
Deny from all
</LocationMatch>