Skip to content

Instantly share code, notes, and snippets.

View andresmgot's full-sized avatar

Andres Martinez Gotor andresmgot

View GitHub Profile

Keybase proof

I hereby claim:

  • I am andresmgot on github.
  • I am andresmgot (https://keybase.io/andresmgot) on keybase.
  • I have a public key ASDyr5RX6io6-c86MgQUe21FpmstXzdbKXWIDgmVyaEXEQo

To claim this, I am signing this object:

local python = {
ID: "python",
compiled: false,
versions: [
{
name: "python27",
version: "2.7",
runtimeImage: "kubeless/python@sha256:34332f4530508a810f491838a924c36ceac0ec7cab487520e2db2b037800ecda",
initImage: "python2.7",
},
local python = {
ID: "python",
compiled: false,
versions: [
{
name: "python27",
version: "2.7",
runtimeImage: "kubeless/python@sha256:34332f4530508a810f491838a924c36ceac0ec7cab487520e2db2b037800ecda",
initImage: "python2.7",
},
@andresmgot
andresmgot / kubeless.toml
Created June 25, 2018 08:06
Configuration for twitter.bal
consumerKey = "CONSUMER_KEY"
consumerSecret = "CONSUMER_SECRET"
accessToken = "ACCESS_TOKEN"
accessTokenSecret = "ACCESS_TOKEN_SECRET"
@andresmgot
andresmgot / twitter.bal
Created June 25, 2018 08:03
Ballerina function to send a tweet
import ballerina/config;
import wso2/twitter;
import kubeless/kubeless;
endpoint twitter:Client twitter {
clientId: config:getAsString("consumerKey"),
clientSecret: config:getAsString("consumerSecret"),
accessToken: config:getAsString("accessToken"),
accessTokenSecret: config:getAsString("accessTokenSecret")
};
# Kubeless Function :P
# Instructions:
#
# $ kubectl apply -f https://gist.githubusercontent.com/andresmgot/8f6e5a491961da93efb0ca7f68b73847/raw/ae206dfe707407deee41155c521c02d091fd0cfa/welcomer.yaml
# service "welcomer" created
# deployment "welcomer" created
#
# $ kubectl proxy -p 8080 &
#
# $ curl --data 'Felipe' localhost:8080/api/v1/namespaces/default/services/welcomer:http-function-port/proxy/
def foo(event, context):
number = int(event["data"])
if number > 1:
for i in range(2, number):
if (number % i) == 0:
return "is not a prime number"
else:
return "is a prime number"
else:
return "is not a prime number"
ignored = ["github.com/kubeless/kubeless/pkg/functions"]
[[constraint]]
name = "github.com/sirupsen/logrus"
branch = "master"
@andresmgot
andresmgot / func.go
Last active April 20, 2018 12:58
Sample function that returns if a number is prime
package kubeless
import (
"fmt"
"math"
"strconv"
"github.com/kubeless/kubeless/pkg/functions"
"github.com/sirupsen/logrus"
)