Skip to content

Instantly share code, notes, and snippets.

@dalitun
dalitun / Dockerfile
Created January 9, 2018 21:51 — forked from orenitamar/Dockerfile
Installing numpy, scipy, pandas and matplotlib in Alpine (Docker)
# Below are the dependencies required for installing the common combination of numpy, scipy, pandas and matplotlib
# in an Alpine based Docker image.
FROM alpine:3.4
RUN echo "http://dl-8.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk --no-cache --update-cache add gcc gfortran python python-dev py-pip build-base wget freetype-dev libpng-dev openblas-dev
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h
RUN pip install numpy scipy pandas matplotlib
@dalitun
dalitun / main.go
Created January 7, 2018 02:30 — forked from chadlung/main.go
An example Go (golang) REST service that uses JWT (JSON Web Tokens) and Negroni http://www.giantflyingsaucer.com/blog/?p=5994
package main
// Generate RSA signing files via shell (adjust as needed):
//
// $ openssl genrsa -out app.rsa 1024
// $ openssl rsa -in app.rsa -pubout > app.rsa.pub
//
// Code borrowed and modified from the following sources:
// https://www.youtube.com/watch?v=dgJFeqeXVKw
// https://goo.gl/ofVjK4
@dalitun
dalitun / jwt_golang_example.go
Created January 7, 2018 02:27 — forked from thealexcons/jwt_golang_example.go
JSON Web Tokens in Go
package main
import (
"io/ioutil"
"log"
"strings"
"net/http"
"encoding/json"
"fmt"
"time"
@dalitun
dalitun / jwt-example.go
Created January 7, 2018 02:26
JsonWebTokens Example with generated key.
/* rewritten example of JsonWebToken example
* from https://gist.github.com/thealexcons/4ecc09d50e6b9b3ff4e2408e910beb22
* Keys are generated and packed to PEM-format at server start
* Plus some fixes and refactors
*
* My respect to thealexcons
*/
package main
import (
@dalitun
dalitun / ssh.go
Created December 29, 2017 17:11 — forked from andrielfn/ssh.go
Go lang SSH connection
package main
import (
"bytes"
"code.google.com/p/go.crypto/ssh"
"fmt"
"io/ioutil"
"os"
)
@dalitun
dalitun / populate.go
Created December 29, 2017 17:10 — forked from andrielfn/populate.go
Script to populate MySQL databases up to the *size-limit*. OS X binary download: https://www.dropbox.com/s/2gecxhqkxa7wpmq/bombsql?dl=0.
package main
import (
"database/sql"
"fmt"
"log"
"os"
"strconv"
_ "github.com/go-sql-driver/mysql"
@dalitun
dalitun / answer_pic.go
Created December 22, 2017 18:43 — forked from tetsuok/answer_pic.go
An answer of the exercise: Slices on a tour of Go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
// Allocate two-dimensioanl array.
a := make([][]uint8, dy)
for i := 0; i < dy; i++ {
a[i] = make([]uint8, dx)
}
@dalitun
dalitun / golang-fr.md
Created October 25, 2017 18:33 — forked from leg0ffant/golang-fr.md
Golang introduction [FR]

Cours langage GO - annotation - Anthony Le Goff


#INTRO ALGORITHME SOUS GO De l'écriture du premier programme à la logique informatique golang

http://golang.org

Premier programme et présentation de "hello world"

{
"heat_template_version": "2014-10-16",
"description": "A simple server to run wordpress",
"parameters": {
"key_name": {
"type": "string",
"description": "Name of an existing key pair to enable SSH access to the instance."
},
"NetID": {
"type": "string",
heat_template_version: 2014-10-16
description: A simple server to run wordpress
parameters:
key_name:
type: string
description: Name of an existing key pair to enable SSH access to the instance.
default: honey
NetID:
type: string