Skip to content

Instantly share code, notes, and snippets.

@aleung
aleung / clean_aged_artifacts.rb
Last active April 24, 2017 18:07
Clean up unused (long time no download) artifacts from Artifactory repository. See: http://aleung.github.com/blog/2013/03/22/clean-aged-artifacts-from-artifactory/
#!/bin/env ruby
# --- Configuration ---------------------------------
# Remove artifacts which were created before $age_days ago and haven't been downloaded in recent $age_days.
$age_days = 730
# The repository to be cleaned.
$repo = 'repository-key'
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>localrepodeployer</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
@aleung
aleung / applicationContext.xml
Created June 15, 2012 04:00
Spring bean reference injection definition by external configuration.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-autowire="byType">
<context:property-placeholder location="file:bin/leoliang/spring/test1/bean.properties"/>
@aleung
aleung / HttpServer.java
Created November 8, 2011 13:47
Tiny HTTP Server by Java, only supports GET method.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
@aleung
aleung / ApplicationContextDumper.java
Created November 8, 2011 06:41
Dump beans information in a Springframework application context. Licensed under WTFPL v2. More detail in blog post: http://aleung.github.io/blog/2011/11/08/Dump-beans-information-from-live-Spring-application-context/
package leoliang.springtest;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.support.AbstractRefreshableApplicationContext;