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
// taken from: http://stackoverflow.com/a/10712949/198996 | |
// note: you don't have to change anything in this class | |
public class GTalkOAuthSASLMechanism extends SASLMechanism { | |
public static final String NAME = "X-GOOGLE-TOKEN"; | |
public GTalkOAuthSASLMechanism(SASLAuthentication saslAuthentication) { | |
super(saslAuthentication); | |
} |
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
@Override | |
protected void doPost(HttpServletRequest req, HttpServletResponse resp) | |
throws ServletException, IOException { | |
try { | |
InputStream stream = req.getInputStream(); | |
// do whatever you want with the stream now | |
} catch (Exception ex) { | |
throw new ServletException(ex); | |
} |
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
InputStream stream = getServletContext().getResourceAsStream("/WEB-INF/file.txt"); |
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
// ... | |
var proxySnippet = require("grunt-connect-proxy/lib/utils").proxyRequest; | |
gruntConfig.connect = { | |
server: { | |
options: { | |
port: 9000, | |
hostname: "0.0.0.0", | |
keepalive: true, | |
middleware: function(connect, options) { |
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
std::cout << "debug message: " << array.size() << std::endl; |
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
List<String> data = new LinkedList<String>(); | |
// or if you know the amount of data upfront: | |
List<String> data = new ArrayList<String>(3); | |
data.add("hello"); | |
data.add("hello"); | |
data.add("bye"); | |
System.out.println(data.size()); // 3 | |
// in order to lookup data you always have to iterate the whole list until you find the value you're looking for |
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 | |
sudo apt-get update --yes | |
sudo apt-get upgrade --yes | |
curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh | |
sudo bash install-logging-agent.sh | |
sudo rm install-logging-agent.sh | |
sudo apt-get install git default-jdk maven --yes |
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 | |
logger "started" | |
sudo apt-get update --yes | |
sudo apt-get upgrade --yes | |
cd worker/ | |
git clean -fdx | |
git checkout master |
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
Compute compute = ComputeOptions.defaultInstance().service(); | |
String instanceName = "bla"; | |
String projectId = "blu"; | |
String zone = "ble"; // e.g. europe-west1-d | |
InstanceId instanceId = InstanceId.of(projectId, zone, instanceName); | |
Instance instance = compute.getInstance(instanceId); | |
try { |
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 | |
# install node | |
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - | |
sudo apt-get install git nodejs --yes | |
# fix npm permissions: https://docs.npmjs.com/getting-started/fixing-npm-permissions | |
mkdir ~/.npm-global | |
npm config set prefix '~/.npm-global' | |
echo "export PATH=~/.npm-global/bin:\$PATH" >> ~/.profile |