Skip to content

Instantly share code, notes, and snippets.

go_version=go1.2.2.linux-amd64
if [ ! -e $go_version.tar.gz ]
then
wget https://storage.googleapis.com/golang/$go_version.tar.gz
tar xf $go_version.tar.gz
fi
export GOROOT=$WORKSPACE/go
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@ergoz
ergoz / 0_reuse_code.js
Created August 15, 2014 10:05
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# Add multimedia source
echo "deb http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
echo "deb-src http://www.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list
apt-get update
apt-get install deb-multimedia-keyring # if this aborts, try again
apt-get update
# Go to local source directory
cd /usr/local/src
package org.kilonet;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
package main
import (
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello world"))
}
@ergoz
ergoz / gocraft.go
Created September 24, 2014 12:40 — forked from yvasiyarov/gocraft
package main
import (
"github.com/gocraft/web"
"net/http"
)
type Context struct {
HelloCount int
}
@ergoz
ergoz / Dockerfile
Last active August 29, 2015 14:13 — forked from MoriTanosuke/Dockerfile
FROM debian:stable
EXPOSE 8080
RUN apt-get -y update && apt-get -y upgrade && apt-get -y install apt-utils dialog unzip wget openjdk-7-jdk
RUN wget -q http://download.jetbrains.com/upsource/upsource-1.0.12551.zip && unzip upsource-1.0.12551.zip
RUN cd Upsource && ./bin/upsource.sh start
@ergoz
ergoz / pysyslog.py
Last active August 29, 2015 14:14 — forked from marcelom/pysyslog.py
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'