Skip to content

Instantly share code, notes, and snippets.

@jalex19100
jalex19100 / LiferayScripting.rb
Last active November 11, 2015 22:44
Some handy ruby scripting for Liferay Administration
### LIST users
userCount = com.liferay.portal.service.UserLocalServiceUtil.getUsersCount();
users = com.liferay.portal.service.UserLocalServiceUtil.getUsers(0, userCount);
users.each{ |user| $out.print user.getFullName() + "\n"}
userCount = com.liferay.portal.service.UserLocalServiceUtil.getUsersCount();
users = com.liferay.portal.service.UserLocalServiceUtil.getUsers(0, userCount);
users.each{ |user| $out.print user.toString()+ "\n" }
### UPDATE user properties
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
@jalex19100
jalex19100 / self-destruct.js
Created January 22, 2014 17:47
Self-Destruct JavaScript function - executes the contents of the function once, but does nothing on any subsequent calls. Pretty straightforward.
var selfDestructMessage = function(element) {
// Do some stuff
selfDestructMessage = function(element) { /* Replace myself with an empty block */ }
};
@jalex19100
jalex19100 / aws user-data to change default ssh port
Last active August 17, 2021 09:01
User-Data script for AWS, to change the default SSHD port from 22 to 2222, or 443, the same port HTTPS uses.
#!/bin/bash -ex
perl -pi -e 's/^#?Port 22$/Port 2222/' /etc/ssh/sshd_config
service sshd restart || service ssh restart