Skip to content

Instantly share code, notes, and snippets.

Avatar

Mustafa Turan mustafaturan

View GitHub Profile
View untar-remote-tgz-file.md

Untar remote file to local directory

Downloading a tar.gz file and extracting it after the download completes might consume a lot of disk space and time. It is possible to write tar.gz file directly as input to tar command and untar it to directory directly from remote url.

wget -qO- your_link_here | tar -xvz -C /target/directory
@mustafaturan
mustafaturan / mount-ssd.md
Last active Jun 27, 2022
Mount SSD with Fstab User Write Permissions
View mount-ssd.md
# Create the folder to mount drive 
sudo mkdir /mnt/storage

# Set user/group perms to write
chown -R pi:pi /mnt/storage

# find the driver properties
sudo blkid
@mustafaturan
mustafaturan / update-limit.sh
Last active Jun 12, 2022
Set max open files limit on mac
View update-limit.sh
sudo sysctl -w kern.maxfiles=75000
sudo sysctl -w kern.maxfilesperproc=75000
ulimit -S -n 75000
@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 Feb 25, 2020
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: