Skip to content

Instantly share code, notes, and snippets.

@anthavio
anthavio / SparkSaAPI.scala
Last active December 13, 2018 17:05
Standalone Spark cluster http://master:8080/json/ client
package zx.spark
import java.time.{Instant, LocalDateTime, ZoneId}
import java.util.concurrent.TimeUnit
import cats.effect.Sync
import cats.implicits._
import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.core.{JsonParser, JsonToken}
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.deser.std.StdDeserializer
<?xml version="1.0"?>
<VAST version="2.0">
<Ad id="441492">
<InLine>
<AdSystem version="1.0">Manage.com</AdSystem>
<AdTitle>
<![CDATA[441492]]>
</AdTitle>
<Description/>
<Impression>
@anthavio
anthavio / openssl.cnf
Last active August 29, 2015 14:11
OpenSSL CA
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
[ ca ]
default_ca = CA_default # The default ca section
[ CA_default ]
dir = /Devel/pki/CA # top dir
certs = $dir/certs # Where the issued certs are kept
crl_dir = $dir/crl # Where the issued crl are kept
database = $dir/index.txt # database index file.
@anthavio
anthavio / gist:38d0ba4c916ab1911a47
Created December 18, 2014 22:11
redis windows errors
redis 2.8.17
[5288] 18 Dec 22:04:02.908 #
The Windows version of Redis allocates a memory mapped heap for sharing with
the forked process used for persistence operations. In order to share this
memory, Windows allocates from the system paging file a portion equal to the
size of the Redis heap. At this time there is insufficient contiguous free
space available in the system paging file for this operation (Windows error
0x5AF). To work around this you may either increase the size of the system
paging file, or decrease the size of the Redis heap with the --maxheap flag.
@anthavio
anthavio / gist:77997d5c4aff211e98c8
Created December 5, 2014 11:36
openssl conversions
# id_dsa is openssh private key
openssl dsa -in id_dsa -outform pem > id_dsa.pem
openssl dsa -in id_dsa -outform der > id_dsa.cer
openssl dsa -in id_dsa.pem -pubout > id_dsa.pub.pem
openssl dsa -in id_dsa -pubout -outform der > id_dsa.pub.cer
# DER file (.crt .cer .der) to PEM
openssl x509 -inform der -in certificate.cer -out certificate.pem
@anthavio
anthavio / gist:98885c6155c7ec991ec9
Created September 16, 2014 18:13
Spring OAuth2RestTemplate and Token Edpoint with self-signed certificate
class SSLContextRequestFactory extends SimpleClientHttpRequestFactory {
private final SSLContext sslContext;
public SSLContextRequestFactory(SSLContext sslContext) {
this.sslContext = sslContext;
}
@anthavio
anthavio / jstatd
Last active January 14, 2016 13:09
jstatd /etc/init.d script
#!/bin/sh
# chkconfig: 345 99 05
# description: Java jstatd utility
# Install
# /etc/init.d/jstatd
# chkconfig --add jstatd
# Optional variables:
# JAVA_HOME, JPS_BIN, JSTATD_BIN, JSTATD_PORT, POLICY_FILE
# JPS_APP_ID, JVM_START_LOG, START_TIMEOUT, STOP_TIMEOUT, TIME_STEP
@anthavio
anthavio / Cloudbees
Last active August 29, 2015 14:00
Releasing Maven Project
http://developer-blog.cloudbees.com/2014/02/how-to-do-maven-release-builds-from.html
http://wiki.cloudbees.com/bin/view/DEV/Sharing+Files+with+Build+Executors
@anthavio
anthavio / SeleniumWaitBuilder.java
Last active August 29, 2015 13:59
SeleniumWaitBuilder
package com.nature.quickstep.test;
import java.util.ArrayList;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
@anthavio
anthavio / spring-security-3.0.xml
Last active December 8, 2015 11:22
spring-security xml exploded configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:ctx="http://www.springframework.org/schema/context"
xmlns:sec="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">