Skip to content

Instantly share code, notes, and snippets.

View inancgumus's full-sized avatar

İnanç Gümüş inancgumus

View GitHub Profile
@inancgumus
inancgumus / Golang-binary-versioning.md
Created July 27, 2017 11:15 — forked from rafecolton/Golang-binary-versioning.md
Copypasta for easy versioning for your Go binaries

Golang Binary Versioning Trick

To use, place the code in version_trick.go in your project. Don't forget to change the namespace to match yours to the actual name of your package.

In addition to version_trick.go, there's a makefile-snippet, that includes the secret sauce for making this trick work. Be sure to change the package name there as well.

Enjoy!

P.S. Special thanks to @meatballhat by way of @syscomet for showing me this trick!

@inancgumus
inancgumus / main.go
Last active July 5, 2017 11:46
Golang decorator pattern
package main
import (
"fmt"
)
type displayFunc func(s string)
func decorate(f displayFunc) displayFunc {
return func(s string) {
@inancgumus
inancgumus / mongoDao
Created June 16, 2017 11:32 — forked from jameBoy/mongoDao
封装一个mgo的简单使用
package dao
import (
"gopkg.in/mgo.v2/bson"
"time"
"gopkg.in/mgo.v2"
"strings"
"log"
)
@inancgumus
inancgumus / mgoTestExample
Created June 16, 2017 11:31 — forked from laeshiny/mgoTestExample.go
mgo test example
package main
import (
"fmt"
"gopkg.in/mgo.v2"
"gopkg.in/mgo.v2/bson"
"time"
)
type Content struct {
@inancgumus
inancgumus / serializejson.go
Created June 6, 2017 12:23
Serialize (Marshall) JSON into a writable stream
package main
import (
"bufio"
"encoding/json"
"fmt"
"os"
)
func main() {
@inancgumus
inancgumus / exercise_18_slices_pic_show.go
Last active August 23, 2023 10:58
go tour exercise solutions
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
p := make([][]uint8, dy)
for y := range p {
p[y] = make([]uint8, dx)
for x := 0; x < dx; x++ {
p[y][x] = uint8(x^y)
@inancgumus
inancgumus / xmlToJson.xslt
Created May 16, 2017 10:20
XML to JSON using XSLT
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="utf-8"/>
<xsl:template match="/*[node()]">
<xsl:text>{</xsl:text>
<xsl:apply-templates select="." mode="detect" />
<xsl:text>}</xsl:text>
</xsl:template>
@inancgumus
inancgumus / installing-react-vr.sh
Last active March 21, 2017 11:52
downloads, installs and opens the sample page
#
# run me by typing this:
#
# bash <(curl -s https://gist.githubusercontent.com/inancgumus/478ac54e68091cfdc2a088ceece21a66/raw/4220d45c3e9c15bbabc596c0d086b32be3416cbe/installing-react-vr.sh)
#
curl https://s3.amazonaws.com/static.oculus.com/reactvr/React_VR_Prerelease.zip
unzip React_VR_Prerelease.zip && mv preview react-vr && rm -f React_VR_Prerelease.zip
#!/usr/bin/env bash
#Code adapted from https://gist.github.com/yangj1e/3641843c758201ebbc6c (Modified to Python3.5)
cd ~
#wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda2-2.4.0-Linux-x86_64.sh
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda3-2.4.1-Linux-x86_64.sh
bash Anaconda3-2.4.1-Linux-x86_64.sh -b
echo 'PATH="/home/ubuntu/anaconda3/bin:$PATH"' >> .bashrc
. .bashrc
@inancgumus
inancgumus / # postgresql - 2016-12-08_20-57-24.txt
Created December 8, 2016 18:04
postgresql on macOS 10.12.1 - Homebrew build logs
Homebrew build logs for postgresql on macOS 10.12.1
Build date: 2016-12-08 20:57:24