Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View VladRassokhin's full-sized avatar

Vladislav Rassokhin VladRassokhin

View GitHub Profile
@4ndrej
4ndrej / SSLPoke.java
Last active January 3, 2024 09:50
Test of java SSL / keystore / cert setup. Check the comment #1 for howto.
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
@VladRassokhin
VladRassokhin / gravatar.tag
Created June 8, 2012 23:15
Simple gravatar.tag for JSP
<%@ tag import="java.util.Formatter"
%><%@ tag import="java.security.MessageDigest"
%><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ attribute name="email" required="true" type="java.lang.String"
%><%@ attribute name="sz" required="false" type="java.lang.Integer"
%><c:if test="${empty sz}"><c:set var="sz">20</c:set></c:if><c:choose
><c:when test="${empty email}"><c:set var="hash">00000000000000000000000000000000</c:set></c:when><c:otherwise
><c:set var="hash"><%=javax.xml.bind.DatatypeConverter.printHexBinary(MessageDigest.getInstance("MD5").digest(email.toLowerCase().trim().getBytes("UTF-8"))).trim().toLowerCase()%></c:set></c:otherwise
></c:choose><img class="gravatarimg${sz}" src="http://www.gravatar.com/avatar/${hash}?s=${sz}&d=mm" alt="">
@skarllot
skarllot / bashrc.sh
Last active January 4, 2023 22:44
Default Bash prompt (bashrc PS1)
# Each distribution default Bash prompts
# Gentoo (/etc/bash/bashrc)
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '
else
PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
fi