Skip to content

Instantly share code, notes, and snippets.

Mustafa Turan mustafaturan

Block or report user

Report or block mustafaturan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mustafaturan
mustafaturan / Dockerfile
Last active Sep 4, 2019
Go - Dockerfile - 9.22MB
View Dockerfile
FROM golang:1.13 as build
WORKDIR /app
COPY go.mod go.sum ./
RUN GO111MODULE=on go mod download
COPY . .
RUN CGO_ENABLED=0 go build -v
@mustafaturan
mustafaturan / stack.go
Last active Jul 7, 2019
Stack Implementation With Go
View stack.go
package stack
type Stack struct {
*node
}
type node struct {
value string
next *node
}
@mustafaturan
mustafaturan / list-open-ports.md
Created May 17, 2019
List open ports with programs/pids
View list-open-ports.md

List open ports

Long version

netstat --tcp --listening --programs --numeric

Short version

netstat -tlpn
@mustafaturan
mustafaturan / ssh-key-login-on-pie.md
Created May 17, 2019
Login via private ssh key on Raspberry Pi
View ssh-key-login-on-pie.md
cd
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
sh -c 'echo "ssh-rsa ... sample@example.com" >> ~/.ssh/authorized_keys'
chmod 600 ~/.ssh/authorized_keys
@mustafaturan
mustafaturan / docker-on-pi.sh
Last active May 17, 2019
Install docker and run without sudo on Raspberry Pi
View docker-on-pi.sh
#!/bin/bash
# Install docker
curl -sSL https://get.docker.com | sh
# Create docker user group
sudo groupadd docker
# Add current user to the docker group
sudo gpasswd -a $USER docker
View go-tips.md
View keybase.md

Keybase proof

I hereby claim:

  • I am mustafaturan on github.
  • I am mustafaturan (https://keybase.io/mustafaturan) on keybase.
  • I have a public key ASDalIfoD1SIl81d7uiK4_TQjNTeQ1BUFwDp91zi7M_gXgo

To claim this, I am signing this object:

View chunk.go
# https://play.golang.org/p/JxqibtHkuO-
func chunkBy(items []string, chunkSize int) (chunks [][]string) {
for chunkSize < len(items) {
items, chunks = items[chunkSize:], append(chunks, items[0:chunkSize:chunkSize])
}
return append(chunks, items)
}
View setup-protobuf-mac.sh
#!/bin/bash
wget https://github.com/protocolbuffers/protobuf/archive/v3.7.0rc2.tar.gz
tar -zxvf protobuf-3.7.0rc2.tar.gz
cd protobuf-3.7.0rc2
./autogen.sh
./configure
make
make install
@mustafaturan
mustafaturan / json.ex
Last active Aug 6, 2018
Wrapper for the fastest Elixir JSON encode/decode library
View json.ex
defmodule JSON do
@moduledoc false
@encode_opts [:use_nil]
@decode_opts [:return_maps, :use_nil]
alias :jiffy, as: Jiffy
@doc """
Encode and return tuple
You can’t perform that action at this time.