Skip to content

Instantly share code, notes, and snippets.

View philmadden83's full-sized avatar

Phil Madden philmadden83

  • Vivid Seats
  • Chicago, IL
View GitHub Profile
@philmadden83
philmadden83 / main.yml
Created March 14, 2019 15:29
Virtualbox role for ansible
---
- name: Create tmp Download Dir
file:
path: "{{ ansible_user_dir }}/tmp/virtualbox/{{ virtualbox_version }}"
state: directory
recurse: yes
#- name: Download .dmg
# get_url:
# url: "https://download.virtualbox.org/virtualbox/{{ virtualbox_version }}/{{ virtualbox_dmg_name }}"
@philmadden83
philmadden83 / Randomizer
Last active January 26, 2018 17:11
Example of using a Comparator to shuffle elements in an array.
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
public final class Shuffler {
private static final RandomComparator RANDOM_COMPARATOR = new RandomComparator();
public static <T> List<T> shuffle(T[] args) {
List<T> argList = Arrays.asList(args);
@philmadden83
philmadden83 / gist:de2c8ae36b8c4690587ad5e363a119b9
Created October 13, 2017 19:18
Terraform unable to associate target group with multiple albs.
terraform apply --target aws_alb_listener_rule.alb-rule
aws_vpc.Vivid: Refreshing state... (ID: vpc-cd9ce4a5)
aws_security_group.public-alb: Refreshing state... (ID: sg-fcc43a8e)
aws_subnet.d_public: Refreshing state... (ID: subnet-4b0e7523)
aws_subnet.e_public: Refreshing state... (ID: subnet-32e7961a)
aws_alb_target_group.tg: Refreshing state... (ID: arn:aws:elasticloadbalancing:us-east-1:...6:targetgroup/tfs-web/d9bfbab5c1e3d220)
aws_alb_target_group.shared-tg: Refreshing state... (ID: arn:aws:elasticloadbalancing:us-east-1:...tgroup/webservices-tg/1e51254c87b8edea)
aws_alb.abl2: Refreshing state... (ID: arn:aws:elasticloadbalancing:us-east-1:...adbalancer/app/TfsWeb/92474f044f2aacc6)
aws_alb_listener.listener-alb2-default: Refreshing state... (ID: arn:aws:elasticloadbalancing:us-east-1:...sWeb/92474f044f2aacc6/862fad5f052e4c48)
aws_alb_listener_rule.alb1-rule: Creating...
@philmadden83
philmadden83 / gist:fd1b31b32aecc53a2225dbfe71f3514c
Created September 8, 2017 14:32
Installing and running vivid-web with local tomcat and symlinks.
#!/bin/bash
PROJECT_PATH=$(pwd)
TOMCAT_VERSION="7.0.64"
TOMCAT_INSTALL_PATH="${HOME}/servers/tomcat"
TOMCAT_HOME="${TOMCAT_INSTALL_PATH}/${TOMCAT_VERSION}"
if [ ! -d "${PROJECT_PATH}/target" ]; then
mvn clean install
fi
package com.vivid.mq.sqs;
import com.amazonaws.services.sqs.model.Message;
import com.vivid.micro.GenericsUtil;
import com.vivid.micro.GsonMarshaller;
import com.vivid.mq.MessageHandler;
import com.vivid.mq.MessageQueueConsumer;
import com.vivid.mq.exception.HandlerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@POST
@Authenticate
@Path("/{trackingId}")
public Response updateAirbillOrderToShipped(@PathParam("trackingId") String trackingId) {
List<Integer> orderIdList = shippingNotificationService.getOrderIdListByTrackingId(trackingId);
if (CollectionUtils.isEmptry(orderIdList)) {
return Response.status(Response.Status.NOT_FOUND).entity(new ErrorResponseEntity("No orders found with the provided tracking ID.")).build();
}
@POST
@Path("/paymentmethods")
public Response (String paymentNonce, String email) throws RequestException {
Account account = userService.getAccount(email);
PaymentAccount paymentAccount = paymentService.verifyPaymentMethod(request);
return Response.ok(paymentAccount.getExternalId()).build;
}
public PaymentAccount storeCreditCard(String paymentNonce, Account account) throws ClientException {
try{
private void createOrder(ResponsysTask task, Account account) throws ResponsysException {
try {
Profile profile = getProfile(account, attribtues.get(EMAIL_ADDRESS_FIELD_NAME));
updateProfile(account, attribtues);
} catch (RecordNotFoundException e) {
createProfile(account, attribtues);
}
createSupplementalTableData(account, configuration.getOrdersTable(), ENTITY_FACTORY.getProfileExtensionRecord(task.getAttributes()));
}
<connection>
<name>SkyBox</name>
<server>127.0.0.1</server>
<type>MYSQL</type>
<access>Native</access>
<database>torpedo</database>
<port>1100</port>
<username>torpedoadmin</username>
<password>${PASSWORD}</password>
<servername/>
@Service
public class ThreatDetectService {
private final ThreatService threatService
..constructor / injection
public void recordLoginEvent(String email, ... , Environment environment) {
recordEvent(new LoginEvent(email, ..., environment));
}