Skip to content

Instantly share code, notes, and snippets.

View owulveryck's full-sized avatar

Olivier Wulveryck owulveryck

View GitHub Profile
@owulveryck
owulveryck / item.go
Created February 2, 2017 15:03
Golang / Reflection
package item
import (
"errors"
"reflect"
)
// Marshal takes an interface and returns an Item compatible with tidedot
func Marshal(o interface{}) map[string]interface{} {
oType := reflect.TypeOf(o)
@owulveryck
owulveryck / csv.go
Last active March 10, 2017 13:25
Decoding a csv to an object in GO
package main
import (
"encoding/csv"
"io"
"reflect"
)
// test holds a structure
type test struct {
@owulveryck
owulveryck / dynamodbCreateTable.go
Last active October 29, 2019 20:21
Dynamodb operations
func createTable(svc *dynamodb.DynamoDB, tableName string) error {
params := &dynamodb.CreateTableInput{
AttributeDefinitions: []*dynamodb.AttributeDefinition{ // Required
{ // Required
AttributeName: aws.String("Key"), // Required
AttributeType: aws.String("S"), // Required
},
{ // Required
AttributeName: aws.String("SortKey"), // Required
AttributeType: aws.String("S"), // Required
@owulveryck
owulveryck / dynamodbQuery.go
Created March 20, 2017 10:14
Simple Query to Dynamodb
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
"log"
)
# -*- coding: utf-8 -*-
"""
pygments.lexers.graphql
~~~~~~~~~~~~~~~~~~~~
Lexers for GraphQL formats.
:copyright: Copyright 2017 by Martin Zlámal.
:license: BSD, see LICENSE for details.
"""
@owulveryck
owulveryck / main.go
Last active January 11, 2018 04:18
Quick'n'Dirty aws price parser
package main
import (
"encoding/gob"
"encoding/json"
"flag"
"log"
"net/http"
"os"
"time"
@owulveryck
owulveryck / app.js
Last active November 24, 2022 22:08
WebSocket simple example / server in go, client in JS
window.addEventListener("load", function(evt) {
var output = document.getElementById("output");
var input = document.getElementById("input");
var ws;
var print = function(message) {
var d = document.createElement("div");
d.innerHTML = message;
output.appendChild(d);
@owulveryck
owulveryck / main.go
Created May 18, 2017 08:19
Exclude a ping from the rest of the middlewares processing / Negroni / Gorilla
package main
import (
"fmt"
"github.com/gorilla/mux"
"github.com/urfave/negroni"
"net/http"
)
type ping struct {
package main
import (
"encoding/json"
"fmt"
"log"
"os"
"time"
)
@owulveryck
owulveryck / index.html
Created June 5, 2017 08:16
Using gopherjs to control a youtube video
<html>
<head>
</head>
<body>
<div id="player"></div>
<script src="app.js"></script>
</body>
</html>