Skip to content

Instantly share code, notes, and snippets.

package some.package;
import java.io.File;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.LogManager;
import org.apache.log4j.xml.DOMConfigurator;
/**
* ServletContextListener to initialize Logging for the application
@iambigd
iambigd / gist:0d7e9f7dc0e5672bf989
Created May 12, 2014 09:08
Create signature with HMAC
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.util.Random;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
@iambigd
iambigd / gist:10952128
Created April 17, 2014 04:05
Generating an API Signature - Kayako Developer Resources - Kayako Wiki
<?php
$apiKey = "apikey";
$secretKey = "secretkey";
// Generates a random string of ten digits
$salt = mt_rand();
// Computes the signature by hashing the salt with the secret key as the key
@iambigd
iambigd / gist:10952096
Created April 17, 2014 04:04
Generating an API Signature - Kayako Developer Resources - Kayako Wiki
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.GeneralSecurityException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.bouncycastle.util.encoders.Base64Encoder;
@iambigd
iambigd / gist:8554290
Created January 22, 2014 06:28
How to get TOMCAT properties from server.xml configuration file
package test;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.channels.NonWritableChannelException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@iambigd
iambigd / asset.php
Created July 30, 2013 13:45 — forked from dcsg/asset.php
<?php
// require 'path/to/vendor/autoload.php';
use Assetic\Asset\FileAsset;
$asset = new FileAsset('path/to/file.js');
header('Content-Type: application/javasript');
echo $asset->dump();
<?php
namespace app\extensions\helper;
use Assetic\AssetWriter;
use Assetic\AssetManager;
use Assetic\FilterManager;
use Assetic\Asset\AssetCache;
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;