Skip to content

Instantly share code, notes, and snippets.

@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@max747
max747 / VelocityEngineUtils.java
Created May 25, 2011 08:52
Using Velocity Tools 2.0 in SpringFramework 3.0.x
/*
* Copyright 2002-2006 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@gcorrao
gcorrao / Reachable.java
Created June 9, 2011 19:25
Java - test INetAddress speed against regular ping
import java.net.InetAddress;
import java.util.Arrays;
public class Reachable {
public static void main(String[] args) {
try {
long startTime;
boolean result;
@jonnyreeves
jonnyreeves / index.html
Created April 23, 2012 21:38
JavaScript Class Structure using requireJS. The following code shows you how to create a Class definition in one JavaScript file and then import it for use in another; coming from an ActionScript 3 background this (and some of JavaScript specific traits)
<!DOCTYPE html>
<html>
<head>
<script data-main="usage" src="http://requirejs.org/docs/release/1.0.8/comments/require.js"></script>
</head>
<body>
<p>Check your JavaScript console for output!</p>
</body>
</head>
@jewelsea
jewelsea / HTMLEditorCustomizationSample.java
Created April 28, 2012 00:43
Customize the JavaFX HTMLEditor
import java.util.List;
import java.util.regex.Pattern;
import javafx.application.*;
import javafx.collections.FXCollections;
import javafx.event.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.effect.*;
import javafx.scene.image.*;
import javafx.scene.web.HTMLEditor;
@jtan189
jtan189 / JavaPasswordSecurity.java
Created September 29, 2012 15:10
Java PBKDF2 Password Hashing Code
import java.security.SecureRandom;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.SecretKeyFactory;
import java.math.BigInteger;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
/*
* PBKDF2 salted password hashing.
* Author: havoc AT defuse.ca
@maxpert
maxpert / DumpIndexWriter.java
Created October 8, 2012 16:59
Lucene redis example
package mxp;
import java.io.IOException;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.NumericField;
import org.apache.lucene.index.CorruptIndexException;
@dersteppenwolf
dersteppenwolf / WordpressXMLRpcClient.java
Created November 23, 2012 16:15
Create New Posts in Wordpress using Java and XMLRpc
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
/**
* Create New Posts in Wordpress using Java
*
* //http://codex.wordpress.org/XML-RPC_WordPress_API/Posts#wp.newPost
@didip
didip / download-centos-mirror.sh
Last active March 13, 2019 13:53
Simple script to download CentOS mirror. You can totally put this in cron.
#!/bin/bash
# Number of arguments should be at least 1
if [ $# -lt 1 ]; then
echo "Usage: $0 centos-version-number"
exit 1
fi
VERSION=$1
@mmahadevan-okta
mmahadevan-okta / conf.log4j
Created January 9, 2014 00:01
Configuration file for grc # grc -c conf.log4j tail -f /usr/local/Cellar/tomcat/7.0.47/libexec/logs/catalina.out
# From http://fahdshariff.blogspot.ca/2011/04/highlighting-command-output-with.html
# this configuration file is suitable for displaying log files
#errors
regexp=^.*(ERROR|Error|Exception).*$
colours=bold red
======
#stack trace
regexp=^\s+at [^:]*:\d*\)$
colours=red