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
""" | |
Example of creating an authentication token using a Google Cloud Service | |
Account. This token can then be used as part of the Authorization header in the | |
HTTP request in the form `Authorization: Bearer {token}` to access | |
Signing is expensive (in terms of compute resources) so the token is valid for | |
1 hour before it expires and another must be generated. | |
""" | |
import time |
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 python3 | |
import os | |
import toml | |
import subprocess | |
def get_root_packages(): | |
pipdeptree = subprocess.run( | |
"pipdeptree", |
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 hello; | |
import org.joda.time.LocalTime; | |
public class HelloWorld { | |
public static void main(String[] args) { | |
LocalTime currentTime = new LocalTime(); | |
System.out.println("The current local time is: " + currentTime); | |
System.out.println("Hello World"); | |
} |
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
KUBERNETES_PORT=tcp://10.96.0.1:443 | |
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443 | |
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1 | |
KUBERNETES_PORT_443_TCP_PORT=443 | |
KUBERNETES_PORT_443_TCP_PROTO=tcp | |
KUBERNETES_SERVICE_HOST=10.96.0.1 | |
KUBERNETES_SERVICE_PORT=443 | |
KUBERNETES_SERVICE_PORT_HTTPS=443 |
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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name _; | |
return 307 https://$host$request_uri; | |
} |
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
import unittest | |
from pyamf.remoting.client import RemotingService | |
import webtest | |
class ResponseProxy(object): | |
""" | |
Mimics a urllib2 response from a WebOb response |
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
import timeit | |
import pyamf | |
class Foo(tuple): | |
pass | |
list_of_foo = [] | |
for x in xrange(1000000): | |
list_of_foo.append(Foo(['foo', 'bar', 'baz'])) |
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
import pyamf | |
class TestProtocol(object): | |
def connectionMade(self): | |
self.decoder = pyamf.get_decoder(pyamf.AMF0) | |
self.buffer = self.decoder.stream | |
self.context = self.decoder.context | |
def dataReceived(self, data): | |
self.buffer.append(data) # adds data to the end of the stream without changing the current position of the stream |