Skip to content

Instantly share code, notes, and snippets.

@fabrizioc1
fabrizioc1 / wc-server.xml
Created April 23, 2012 23:20
WCS cXML Message Adapter
<HttpAdapter
deviceFormatId="-10000"
deviceFormatType="XmlHttp"
deviceFormatTypeId="-10000"
enabled="true"
factoryClassname="com.ibm.commerce.programadapter.HttpProgramAdapterImpl" name="XML/HTTP">
<ProgramAdapter>
<SessionContext class="com.ibm.commerce.messaging.programadapter.security.CredentialsSpecifiedProgramAdapterSessionContextImpl">
<SessionContextConfig/>
</SessionContext>
@fabrizioc1
fabrizioc1 / cachespec_example1.xml
Created April 1, 2012 00:01
Cache Invalidation Blog Post - Example 1
<cache-id>
<component id="" type="pathinfo">
<required>true</required>
<value>/ProductDisplay</value>
</component>
<component id="storeId" type="parameter">
<value>10151</value>
<required>true</required>
</component>
<component id="catalogId" type="parameter">
@fabrizioc1
fabrizioc1 / outlook_out_of_office.rb
Created February 28, 2012 19:12
Automating Outlook Out Of Office
##
## This script uses OLE automation to set the out of office message at a given date
##
require 'win32ole'
outlook = WIN32OLE.new('MAPI.Session')
outlook.Logon 'Outlook'
puts "Out of Office = #{outlook.OutOfOffice}"
outlook.OutOfOffice = true
outlook.Logoff
@fabrizioc1
fabrizioc1 / PolynomialTest.java
Created February 23, 2012 04:23
Polynomial Data Structure
/*
* Question: Create a data structure to represent polynomial addition and substraction
* Run the code online: http://ideone.com/s5qjU
*/
import static org.junit.Assert.*;
import org.junit.Test;
import java.util.*;
public class PolynomialTest
{
@fabrizioc1
fabrizioc1 / rvm_bash_prompt.sh
Last active September 29, 2015 14:07
RVM bash prompt
# Add this to your .bashrc after loading RVM
# Example:
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# source $HOME/rvm_bash_prompt.sh
# Current RVM gemset for bash prompt
function __my_rvm_ruby_version {
local gemset=$(echo $GEM_HOME | awk -F'@' '{print $2}')
[ "$gemset" != "" ] && gemset="@$gemset"
local version=$(echo $MY_RUBY_HOME | awk -F'-' '{print $2}')
@fabrizioc1
fabrizioc1 / invalidation.feature
Created January 13, 2012 00:47
CTO cache invalidation
@MQC9056 @inventory @invalidation
Feature: Inventory Cache Invalidation
As a SonyStyle user
In order to place an order for a product
SonyStyle must display accurate inventory information.
# This is to make sure an invalidation is only trigged when a product becomes in stock or goes out of stock
# SPEC00090005226 = "Intel Core i7-2630QM quad-core processor (2.0GHz) with Turbo Boost up to 2.90GHz"
Scenario: US CTO component in stock changes quantity and remains in stock
Given we will receive a "GCTO" inventory feed
@fabrizioc1
fabrizioc1 / akamai_debug_headers.txt
Last active December 6, 2025 12:31
Akamai debug headers
Pragma: akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no
@fabrizioc1
fabrizioc1 / fix_encoding.rb
Created November 21, 2011 17:41
Fixing invalid UTF-8 characters
# first method
def enforce_utf8(from = nil)
begin
self.is_utf8? ? self : Iconv.iconv('utf8', from, self).first
rescue
converter = Iconv.new('UTF-8//IGNORE//TRANSLIT', 'ASCII//IGNORE//TRANSLIT')
converter.iconv(self).unpack('U*').select{ |cp| cp < 127 }.pack('U*')
end
end
@fabrizioc1
fabrizioc1 / puzzle_1.rb
Created November 18, 2011 04:51
puzzle 1
one_million = (1..1e6).to_a
one_million_sum = (1.0e6+1)*1.0e6/2
missing = one_million.delete(rand(one_million.size))
one_million_minus_missing_sum = one_million.reduce(0){|sum,current| sum + current}
puts (one_million_sum - one_million_minus_missing_sum) == missing ? "It works" : "Did not work"
@fabrizioc1
fabrizioc1 / trigger_javadump.sh
Created November 9, 2011 01:16
Script to trigger java dump when WebSphere JVM does a full GC
#!/bin/bash
#
# Run this in the background and keep it running when you log out run it like this:
# nohup /tmp/trigger_javadump.sh >/tmp/trigger_javadump.log 2>&1 &
#
FULLGC_PATTERN='^Application time: 0.0000'
VERBOSEGC_PATH='verbosegc.log'
while true; do
FULLGC_FOUND=$(grep "$FULLGC_PATTERN" "$VERBOSEGC_PATH")