Skip to content

Instantly share code, notes, and snippets.

View mustafaturan's full-sized avatar

Mustafa Turan mustafaturan

View GitHub Profile
@mustafaturan
mustafaturan / update-limit.sh
Last active June 12, 2022 08:03
Set max open files limit on mac
sudo sysctl -w kern.maxfiles=75000
sudo sysctl -w kern.maxfilesperproc=75000
ulimit -S -n 75000
@mustafaturan
mustafaturan / Dockerfile
Last active September 4, 2019 14:06
Go - Dockerfile - 9.22MB
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 July 7, 2019 02:46
Stack Implementation With Go
package stack
type Stack struct {
*node
}
type node struct {
value string
next *node
}
@mustafaturan
mustafaturan / list-open-ports.md
Created May 17, 2019 04:02
List open ports with programs/pids

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 03:24
Login via private ssh key on Raspberry Pi
cd
mkdir ~/.ssh
chmod 700 ~/.ssh
touch ~/.ssh/authorized_keys
sh -c 'echo "ssh-rsa ... [email protected]" >> ~/.ssh/authorized_keys'
chmod 600 ~/.ssh/authorized_keys
@mustafaturan
mustafaturan / docker-on-pi-rootless.sh
Last active July 31, 2025 02:19
Install docker and run without sudo on Raspberry Pi
#!/bin/bash
curl -fsSL https://get.docker.com/rootless | sh
# Content to be added to .bashrc
content='export PATH="$HOME/bin:$PATH"'
# Check if content already exists in .bashrc
if grep -Fxq "$content" ~/.bashrc; then
echo "Content for bin path already exists in .bashrc. Skipping addition."
@mustafaturan
mustafaturan / go-tips.md
Last active April 14, 2019 01:05
Go lang tips

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:

@mustafaturan
mustafaturan / chunk.go
Created February 5, 2019 07:00
Go / Chunk Slice
# 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)
}
@mustafaturan
mustafaturan / setup-protobuf-mac.sh
Created February 2, 2019 05:48
Install protobuf on Mac
#!/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