Skip to content

Instantly share code, notes, and snippets.

require 'date'
# Actually doesn't matter WHAT you choose as the epoch, it
# won't change the algorithm. Just don't change it after you
# have cached computed scores. Choose something before your first
# post to avoid annoying negative numbers. Choose something close
# to your first post to keep the numbers smaller. This is, I think,
# reddit's own epoch.
$our_epoch = Time.local(2005, 12, 8, 7, 46, 43).to_time
@edpichler
edpichler / LerCertificado.java
Created January 29, 2014 10:48
Ler certificado digital em Java
publicclass LerCertificado extends HttpServlet {
protectedvoid doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("");
out.println("ServletLerCertificado");
out.println("");
out.println("Certificado digital:");
String cipherSuite = (String) request.getAttribute("javax.servlet.request.cipher_suite");
@edpichler
edpichler / server.xml
Created January 29, 2014 10:44
server.xml Tomcat file
<Servicename="Catalina">
...
<ConnectoracceptCount="100"connectionTimeout="20000"
executor="tomcatThreadPool"maxKeepAliveRequests="15"port="8080"
protocol="HTTP/1.1"redirectPort="8443"/>
<Connectorport="8443"maxThreads="200"
scheme="https"secure="true"SSLEnabled="true"
keystoreFile="${user.home}/.keystore"keystorePass="password"
clientAuth="true"sslProtocol="TLS"/>
...
@edpichler
edpichler / ChangingLineSize.java
Created January 28, 2014 23:11
Changing the line size of a JFreeChart chart
private JFreeChart createChart(XYDataset dataset, ICarteira car) {
// create the chart...
final JFreeChart chart = ChartFactory.createTimeSeriesChart(
car.getNome(), // title
"Tempo", // x axis label
"Valor", // y axis label
dataset, // data
true, // include legend
true, // tooltips
true // urls
@edpichler
edpichler / mac_parameters_eclipse.txt
Created January 28, 2014 01:01
Other parameters for Eclipse in mac.
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
-Xverify:none
@edpichler
edpichler / params.txt
Created January 28, 2014 00:59
Mac params for Eclipse.
-Xms512m
-Xmx512m
-XX:PermSize=256m
-XX:MaxPermSize=256m-Xms512m
-Xmx512m
-XX:PermSize=256m
-XX:MaxPermSize=256m
@edpichler
edpichler / parameters.txt
Created January 28, 2014 00:48
Tomcat parameters.
-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
@edpichler
edpichler / Tomcat_error_log.log
Created January 28, 2014 00:47
Tomcat error log.
java.lang.UnsupportedOperationException: This parser does not support specification "null" version "null"
@edpichler
edpichler / oracle.sql
Created January 28, 2014 00:43
Showing tables related to some constraint in Oracle.
SELECT CONSTRAINT_NAME, TABLE_NAME FROM USER_CONSTRAINTS WHERE CONSTRAINT_NAME='FK1_MY_CONSTRAINT_NAME';