This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Based on this guide | |
https://stackoverflow.com/questions/23259843/how-to-route-traffic-reverse-proxy-with-haproxy-based-on-request-body | |
frontend http-in | |
bind *:80 | |
option http-buffer-request | |
acl redirect_pingpong req.body -m reg [insert your regular expression here] | |
use_backend pingpong_backend if redirect_pingpong | |
default_backend web_bk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Car profile | |
api_version = 4 | |
Set = require('lib/set') | |
Sequence = require('lib/sequence') | |
Handlers = require("lib/way_handlers") | |
Relations = require("lib/relations") | |
find_access_tag = require("lib/access").find_access_tag | |
limit = require("lib/maxspeed").limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very | |
# well, so I wrote my own script to do the simple job of converting package names. | |
# | |
# You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv | |
# | |
# It'll run faster on a clean build because then there are fewer files to scan over. | |
# | |
# Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Security.Cryptography; | |
using Microsoft.IdentityModel.Tokens; | |
using Newtonsoft.Json; | |
using Org.BouncyCastle.Crypto.Parameters; | |
using Org.BouncyCastle.OpenSsl; | |
namespace TestCommands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Header extends AbstractItem<Header, Header.ViewHolder> { | |
String title; | |
public Header(String title) { | |
this.title = title; | |
} | |
public String getTitle() { | |
return title; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GREEN='\033[0;32m' | |
NC='\033[0m' | |
printf "Generating resConfig from resource dir: $1\n" | |
resconfig="resConfigs" | |
for values in `ls $1 | grep values-`; do | |
log="Inspecting $values" | |
if [ -f "$1/$values/strings.xml" ] | |
then | |
suffix=`echo $values | sed 's/values-//g'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.google.firebase.zerotoapp; | |
public class ChatMessage { | |
public String name; | |
public String message; | |
public ChatMessage() { | |
} | |
public ChatMessage(String name, String message) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Utility class to read encrypted PEM files and generate a | |
* SSL Socket Factory based on the provided certificates. | |
* The original code is by Sharon Asher (link below). I have modified | |
* it to use a newer version of the BouncyCastle Library (v1.52) | |
* | |
* Reference - https://gist.github.com/sharonbn/4104301" | |
*/ | |
import org.bouncycastle.cert.X509CertificateHolder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In HAProxy 1.5, we have to jump through some hops to accomplish a rewrite of a request's path... | |
# We use a temporary header to build our new path from the existing one in the request | |
# and then directly perform a redirect | |
# Clean the request and remove any existing header named X-Rewrite | |
http-request del-header X-REWRITE | |
# Copy the full request URL into the X-REWRITE request header unchanged | |
http-request add-header X-REWRITE %[url] if { path_beg /foo } |
NewerOlder