Skip to content

Instantly share code, notes, and snippets.

@jimhe
jimhe / mysql_to_big_query.sh
Last active February 2, 2017 01:30 — forked from shantanuo/mysql_to_big_query.sh
Copy MySQL table to big query. If you need to copy all tables, use the loop given at the end.Exit with error code 3 if blob or text columns are found. The csv files are first copied to google cloud before being imported to big query.
#!/bin/sh
MYSQL_USER=$1
MYSQL_PASSWORD=$2
MYSQL_HOST=$3
TABLE_SCHEMA=$4
TABLE_NAME=$5
gsutil > /dev/null 2>&1 || {
echo "gsutil not available! Please install google-cloud-sdk: brew cask install google-cloud-sdk"
{
templates: {
'pal-positions' => {
context_text: 'Guns, Germs and Steel',
default_url_options: {"utm_campaign"=>"pal-positions", "utm_source"=>"causes-email", "utm_medium"=>"email-pal"},
},
'pal-topics_support' => {
context_text: 'Bob eats lunch',
default_url_options: {"utm_campaign"=>"pal-topics_support", "utm_source"=>"causes-email", "utm_medium"=>"email-pal"},
}
@jimhe
jimhe / SAMLServlet.java
Last active August 29, 2023 07:46
Servlet to handle SAML Auth request and response. on GET /saml, it will redirect to the ID Provider with the proper SAMLRequest parameter. on POST /saml, it will parse the POST parameter for a properly signed and successful response before allowing the user in.
package com.comprehend.servlet;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.opensaml.Configuration;
import org.opensaml.common.binding.BasicSAMLMessageContext;
import org.opensaml.common.xml.SAMLConstants;
import org.opensaml.saml2.binding.decoding.HTTPPostDecoder;
import org.opensaml.saml2.binding.encoding.HTTPRedirectDeflateEncoder;
import org.opensaml.saml2.core.*;