Skip to content

Instantly share code, notes, and snippets.

View DManavi's full-sized avatar
🚀
Making better tools & making life easier

Danial Manavi DManavi

🚀
Making better tools & making life easier
View GitHub Profile
@DManavi
DManavi / CLEAR_CONTAINER_LOGS_DOCKER.md
Created August 21, 2020 06:14
Clear container logs in docker

How to Clear container logs in docker

After a few months of running your containers, you may need to cleanup the logs. Since these are text logs, after a while, they take a huge amount of hard disk on your host machine. To remove these logs, you can run the command below.

  $ truncate -s 0 $(docker inspect --format='{{.LogPath}}' <your-container-name>)

Let's assume that your container is named 'my-container' so that the command will be

@DManavi
DManavi / README.md
Last active July 29, 2019 04:18
Github/Git sync fork using rebase & branching - Open multiple pull request

Intro

I've start contributing on a closed-source project. The lead developer asked me to use the method below to contribute on this project.

I write this document to help all the people who are new on this method (See below) of contributing on git projects.

Method

  1. Fork the project from the upstream repository (I name the base repository, upstream).
  2. Clone the forked repository on your local machine.
@DManavi
DManavi / Commands.md
Created March 9, 2019 08:34
NAT LXC Without forwarding and IP tables

Run these commands to proxy any TCP/UDP connection from host to your container

lxc config device add {your-container-name} {a-simple-name-for-device} proxy listen={host-protocol}:{host-ip}:{host-port} connect={container-protocol}:{container-ip}:{container-port}

Example values

{your-container-name} = web-server {a-simple-name-for-device} = http-80

{host-protocol} = tcp

@DManavi
DManavi / Guest-Commands.md
Created March 7, 2019 17:13
How to compact virtualbox disks to save space on the host machine?

These commands should execute on your "GUEST" OS/Your virtual machine.

If the OS is a linux, run

dd if=/dev/zero of=/var/tmp/bigemptyfile bs=4096k ; rm /var/tmp/bigemptyfile

if the OS is windows