Skip to content

Instantly share code, notes, and snippets.

if (PermissionLevelManager.PERMISSION_LEVEL_NAME_OWNER.equals(membershipItem.getPermissionLevelName())){
PermissionsMask mask = new PermissionsMask();
mask.put(PermissionLevel.NEW_FORUM, Boolean.valueOf(permBean.getNewForum()));
mask.put(PermissionLevel.NEW_TOPIC, Boolean.valueOf(permBean.getNewTopic()));
mask.put(PermissionLevel.NEW_RESPONSE, Boolean.valueOf(permBean.getNewResponse()));
mask.put(PermissionLevel.NEW_RESPONSE_TO_RESPONSE, Boolean.valueOf(permBean.getResponseToResponse()));
mask.put(PermissionLevel.MOVE_POSTING, Boolean.valueOf(permBean.getMovePosting()));
mask.put(PermissionLevel.CHANGE_SETTINGS,Boolean.valueOf(permBean.getChangeSettings()));
mask.put(PermissionLevel.POST_TO_GRADEBOOK, Boolean.valueOf(permBean.getPostToGradebook()));
mask.put(PermissionLevel.READ, Boolean.val
@buckett
buckett / set-java
Last active January 6, 2021 14:08
set-java(1) for OS X
#!/bin/bash
# Set the current version of Java being used.
# Doesn't at the moment set the path as the mac just pulls them from JAVA_HOME
# Get the current
current=$JAVA_HOME
# Look for the default
default=$(/usr/libexec/java_home)
@buckett
buckett / get-tomcat
Last active January 3, 2016 14:29
get-tomcat
#!/bin/bash -e
# Quick script to download, unpack and muller tomcat.
# Location to download file to, also used like a cache to check if we already have it.
downloads=~/Downloads
# Filename on remote server and in local download folder
file=apache-tomcat-7.0.50.tar.gz
# Location to get download from
remote=http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.50/bin

Keybase proof

I hereby claim:

  • I am buckett on github.
  • I am buckett (https://keybase.io/buckett) on keybase.
  • I have a public key whose fingerprint is 5995 EA73 3654 5C2B DA08 061A 25F2 599A 6903 DA3A

To claim this, I am signing this object:

@buckett
buckett / get-tomcat8
Created April 23, 2015 15:13
Gets a copy of Tomcat 8 and mullers it for Sakai
#!/bin/bash -e
# Quick script to download, unpack and muller tomcat.
# Location to download file to, also used like a cache to check if we already have it.
downloads=~/Downloads
# Filename on remote server and in local download folder
file=apache-tomcat-8.0.20.tar.gz
# Location to get download from
remote=http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.20/bin
# Folder to unpack tomcat into
@buckett
buckett / clean-docker.sh
Created May 19, 2015 11:02
Cleans out old docker images and containers.
#!/bin/bash
# Clean all exited containers
docker ps -qaf status=exited | xargs docker rm
# Remove all unused images
docker images -f dangling=true -q | xargs docker rmi
@buckett
buckett / delete-myworkspace.sql
Last active August 29, 2015 14:21
Delete all MyWorkspace sites from a Sakai deployment
-- Deletes all user myworkspaces we can find.
-- Matthew Buckett
BEGIN WORK;
CREATE TEMPORARY TABLE delete_ids (
id varchar(99) UNIQUE
);
-- If you want to be more brutal you can exlude the join to sakai_user_id_map and just look for all IDs that start with ~
@buckett
buckett / multi-cert
Created July 22, 2015 14:03
Show all the certificates in a certificate chains file.
#!/usr/bin/perl
# script for splitting multi-cert input into individual certs
# Artistic Licence
#
# v0.0.1 Nick Burch <nick@tirian.magd.ox.ac.uk>
# v0.0.2 Tom Yates <tyates@gatekeeper.ltd.uk>
# v0.0.3 Matthew Buckett <matthew.buckett@it.ox.ac.uk>
#
use strict;
@buckett
buckett / make-maven-color
Created October 9, 2015 17:03
Makes maven output coloured, although the -q flag stops working when you do this.
#!/bin/sh
# Simple script to make your copy of maven use coloured output
# Details from http://www.aheritier.net/united-colors-of-maven/
if [[ -z "$M2_HOME" ]]; then
echo \$M2_HOME unset, please set and re-run this script 1>&2
exit 1
fi
cd $M2_HOME || ( echo "\$M2_HOME isn't set to a directory" 1>&2; exit 1)
@buckett
buckett / chcherrypick.sh
Last active February 25, 2016 16:26 — forked from juanjmerono/chcherrypick.sh
Script to list pending commits in 11.x branch
#!/bin/bash
#
# You must run this in the Sakai working directory in master branch
# chcherrypick.sh -u (to update your repo)
# chcherrypick.sh -m (to check the list of pending cherry picks even they are not Verified in jira)
# chcherrypick.sh (to check the list of pending cherry picks)
#
SEPARATOR=$'\n'"###"
SEPARATOREND="###"
CNT=1