Skip to content

Instantly share code, notes, and snippets.

Avatar
🍃

Fatih Arslan fatih

🍃
View GitHub Profile
@fatih
fatih / switchgo.sh
Last active Dec 31, 2019
Switch between go version using https://github.com/golang/dl
View switchgo.sh
function switchgo() {
version=$1
if [ -z $version ]; then
echo "Usage: switchgo [version]"
return
fi
if ! command -v "go$version" > /dev/null 2>&1; then
echo "version does not exist, download with: "
echo " go get golang.org/dl/go${version}"
@fatih
fatih / copyast.go
Created Jul 13, 2019
Fork of wire/internal/copyast with support for *ast.File
View copyast.go
// Copyright 2018 The Wire Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
View keybase.md

Keybase proof

I hereby claim:

  • I am fatih on github.
  • I am arslan (https://keybase.io/arslan) on keybase.
  • I have a public key ASDcvzZWuMBwyPHwpUkOEmBS_jMOB_3NiOjUP-6vPAYePQo

To claim this, I am signing this object:

View test godef
(
set -eux
cd $(mktemp -d)
export GOPATH=$(mktemp -d)
export PATH=$GOPATH/bin:$PATH
git clone https://github.com/ianthehat/godef
cd godef
git checkout f2eb530fb8dbca312f4661b985ec2ae5ba5e7b3a
go install
git clone https://github.com/digitalocean/csi-digitalocean
@fatih
fatih / md-to-hugo.go
Created Nov 29, 2017
Markdown to Hugo converter
View md-to-hugo.go
package main
import (
"bytes"
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"os"
@fatih
fatih / caption-transform.go
Created Nov 16, 2017
Wordpress captions to Hugo shortcodes. This is a terrible hack, not performant. Only here for reference
View caption-transform.go
package main
import (
"fmt"
"io/ioutil"
"log"
"net/url"
"os"
"path/filepath"
"regexp"
@fatih
fatih / changes.diff
Last active Oct 24, 2016
Router example
View changes.diff
--- other.go 2016-10-16 16:23:33.000000000 +0300
+++ demo.go 2016-10-16 16:24:27.000000000 +0300
@@ -9,12 +9,12 @@
)
var Session *http.Server
-var r Router
+var r *Router
func Run(port string) {
View job.vim
func! CloseHandler(channel)
while ch_status(a:channel) == 'buffered'
echomsg ch_read(a:channel)
endwhile
endfunc
let job = job_start(['go', 'build'], {'close_cb': 'CloseHandler'})
View Makefile 2
ifeq ($(strip $(shell git status --porcelain 2>/dev/null)),)
GIT_TREE_STATE=clean
else
GIT_TREE_STATE=dirty
endif
all: build
build:
@echo "==> Building the project"
You can’t perform that action at this time.