Skip to content

Instantly share code, notes, and snippets.

class SQLPredicate<T> {
private final Predicate<T> t;
private final String sql;
SQLPredicate(Predicate<T> t, String name) {
this.t = t;
this.sql = name;
}
static <T> SQLPredicate<T> of(Predicate<T> t, String sql) {
@srcmaxim
srcmaxim / DataSourceHierarchyContextFactory.java
Last active March 14, 2019 16:35
JNDI DataSource implementation
import com.microsoft.sqlserver.jdbc.SQLServerDataSource;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.naming.spi.InitialContextFactory;
import javax.sql.DataSource;
import java.util.Hashtable;
public class DataSourceHierarchyContextFactory implements InitialContextFactory {
@srcmaxim
srcmaxim / Install TP-Link TL-WN722N V2 driver to Ubuntu 20.04.md
Last active November 13, 2023 04:30
Installing a TP-Link TL-WN722N V2 on Ubuntu 20.04
@srcmaxim
srcmaxim / https-website.cfn.yml
Created September 6, 2020 14:53
Creates an S3 bucket configured for hosting a static website, and a Route 53 DNS record pointing to the bucket
AWSTemplateFormatVersion: '2010-09-09'
Description: Creates an S3 bucket configured for hosting a static website, and a Route
53 DNS record pointing to the bucket
Parameters:
HostedZoneId:
Type: String
Description: The DNS name of an existing Amazon Route 53 hosted zone.
AllowedPattern: (?!-)[A-Z0-9]{1,32}(?<!-)
ConstraintDescription: must be a valid Route53 Hosted Zone ID.
@srcmaxim
srcmaxim / app.cfn.yml
Last active October 11, 2020 22:28
AWS MSK Setup
AWSTemplateFormatVersion: 2010-09-09
Parameters:
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the instance
Type: 'AWS::EC2::KeyPair::KeyName'
ConstraintDescription: Can contain only ASCII characters.
VPC:
Description: ID of the VPC for MSK cluster deployment
Type: 'AWS::EC2::VPC::Id'
PublicSubnetOne: