Skip to content

Instantly share code, notes, and snippets.

@ruwanka
ruwanka / gitlab.go
Created November 11, 2018 06:41
Clone all gitlab projects in a group
package main
import (
"encoding/json"
"flag"
"fmt"
"gopkg.in/src-d/go-git.v4"
"io/ioutil"
"net/http"
"os"
// Adding a file directly to index (stage area), without using working tree.
//
// $ go build index-add.go && yes | mv index-add ~/code/workspace/bin
// $ mkdir -p /tmp/sample && cd /tmp/sample
// $ index-add
package main
import (
"bytes"
"fmt"
@owulveryck
owulveryck / AAAReadme.md
Last active November 16, 2018 00:13
Markdown on the fly

Usage

go run *go github.com/owulveryck/test/
@vmarkovtsev
vmarkovtsev / hercules.go
Created September 27, 2018 08:08
Imports from internal packages
package hercules
import (
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
"gopkg.in/src-d/hercules.v4/internal/core"
"gopkg.in/src-d/hercules.v4/internal/plumbing"
"gopkg.in/src-d/hercules.v4/internal/plumbing/identity"
"gopkg.in/src-d/hercules.v4/internal/plumbing/uast"
"gopkg.in/src-d/hercules.v4/internal/yaml"
package commitgraph
import (
"bytes"
"errors"
"io"
"math"
"time"
"gopkg.in/src-d/go-git.v4/plumbing"
package main
import (
"fmt"
"os"
"time"
"gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing"
"gopkg.in/src-d/go-git.v4/plumbing/object"
@rogpeppe
rogpeppe / vgoget.sh
Last active August 4, 2023 07:07
go get binary@version
#!/bin/sh
# This command installs binaries at specified versions
# into $GOBIN, $GOPATH/bin or $HOME/bin.
# It assumes Go 1.11.
if [ $# = 0 ]; then
usage: vgoget cmdpackage[@version]... >&2
exit 2
fi
d=`mktemp -d`
cd "$d"
@rms1000watt
rms1000watt / main.go
Created August 30, 2018 20:25
Clone Git Repo in Pure Go
import (
"errors"
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
"github.com/aws/aws-sdk-go/aws/session"
@wreulicke
wreulicke / handler.go
Created June 9, 2018 17:56
AWS Lambdaでリポジトリの内容を書き換えるサンプル
package main
import (
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"time"
@davidwalter0
davidwalter0 / wayback.go
Last active November 16, 2018 00:15
x/vgo: thoughts on selection criteria for non-versioned go repo
// https://gist.github.com/davidwalter0/60f41b53732656c5c546cc8b0a739d11
// x/vgo: thoughts on selection criteria for non-versioned go repo
// Run git branch version selection for non-vgo versioned repository
// as if in a wayback machine.
// Use the dependency's commit ctime as the wayback ctime.
// Commits prior to the wayback ctime in sub-dependencies are eligible.
// Use the newest commit prior to the wayback ctime.