Skip to content

Instantly share code, notes, and snippets.

@aviramsegal
aviramsegal / gist:4528623
Created January 14, 2013 08:35
Gimp Python-Fu Script for setting DPI for PNG Images
import os, glob
import string
from gimpfu import *
mime_type = 'png';
path = '/home/avirams/Dropbox/articles/WebSphere Scheduler/images'
# here we do a foreach loop
@aviramsegal
aviramsegal / gist:4123719
Created November 21, 2012 08:03
WebSphere Portal Puma runUnrestricted
Context ctx = new InitialContext();
PortletServiceHome pumaService = (PortletServiceHome)ctx.lookup("portletservice/com.ibm.portal.um.portletservice.PumaHome");
PumaHome pumaHome = (PumaHome)pumaService.getPortletService(PumaHome.class);
PrivilegedExceptionAction<Void> action = new PrivilegedExceptionAction<Void>() {
@Override
public Void run() {
// do stuff unrestricted
return null;
}
@aviramsegal
aviramsegal / gist:3864354
Created October 10, 2012 09:29
Detach USB Disk Safely
udisks --unmount /dev/sdb1 && udisks --detach /dev/sdb
@aviramsegal
aviramsegal / gist:3425350
Created August 22, 2012 12:58
WebSphere Application Server Password Encoder/Decoder
#Encode
${WAS_HOME}/java/bin/java -Djava.ext.dirs=${WAS_HOME}/plugins:${WAS_HOME}/lib com.ibm.ws.security.util.PasswordEncoder xxxxxxxx
#Decode
${WAS_HOME}/java/bin/java -Djava.ext.dirs=${WAS_HOME}/plugins:${WAS_HOME}/lib com.ibm.ws.security.util.PasswordDecoder {xor}JycnJycnJyc=
@aviramsegal
aviramsegal / gist:3357656
Created August 15, 2012 08:36
Websphere Application Server Propagate LTPA Token from Subject To HTTP Cookie
public static SingleSignonToken getSSOTokenFromSubject(final Subject subject) {
if (subject == null) {
return null;
}
return AccessController.doPrivileged(new PrivilegedAction<SingleSignonToken>() {
public SingleSignonToken run() {
Set<SingleSignonToken> ssoTokens = subject.getPrivateCredentials(SingleSignonToken.class);
for (SingleSignonToken ssoToken : ssoTokens) {
if (ssoToken.getName().equals("LtpaToken")) {
return ssoToken;
@aviramsegal
aviramsegal / gist:3181669
Created July 26, 2012 12:01
My Bash Prompt
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]┌─[\[\033[01;34m\]\u@\h\[\033[00m\]]──[\[\033[01;34m\]\w\[\033[00m\]]──\n└─\$ "
@aviramsegal
aviramsegal / gist:3075970
Created July 9, 2012 11:36
WebSphere Application Server run as server
/**
* Run code with the server subject
* (having the authorization to do any administration operation)
*/
PrivilegedExceptionAction<Void> action = new PrivilegedExceptionAction<Void>() {
@Override
public Void run() {
// YOUR CODE HERE
return null;
@aviramsegal
aviramsegal / gist:3075966
Created July 9, 2012 11:35
JAX-WS Custom Endpoint
/**
* The following snippets shows how to set a custom endpoint for a JAX-WS generated WebClient on runtime
*/
// Get the service and the port
SampleService service = new SampleService();
Sample port = service.getESamplePort();
// Use the BindingProvider's context to set the endpoint
BindingProvider bp = (BindingProvider)port;
@aviramsegal
aviramsegal / gist:3075963
Created July 9, 2012 11:34
WebSphere Application Server invoking AdminTask Commands using CommandMgr
/**
* CommandMgr can be used to invoke any wsadmin's AdminTask commands
* For list of command and their parameter, use ConfigMgr.getCommandsMetadata and/or look
* at the AdminTask documentation in the WAS infocenter
*
* This code must run inside a server's JVM
*/
CommandMgr cmdMgr = null;
ConfigService cfgService = null;
@aviramsegal
aviramsegal / gist:3075940
Created July 9, 2012 11:31
Install required packages for IBM Installation Manager UI on Redhat x64
yum install gtk2.i686 gtk2-engines.i686 PackageKit-gtk-module.i686 PackageKit-gtk-module.x86_64 libcanberra-gtk2.x86_64 libcanberra-gtk2.i686