Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ssm"
"strings"
)
@nidhi-ag
nidhi-ag / docker-cleanup-resources.md
Created June 10, 2020 06:05 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

## Install perf in docker container
### ubuntu 18.4
### kernel 4.14.173-137.229.amzn2.x86_64
docker exec -it {containerid} sh
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.173.tar.xz && tar -xf ./linux-4.14.173.tar.xz && cd linux-4.14.173/tools/perf/ && apt -y install flex bison && make -C . && make install
./perf
./perf list
./perf bench mem all
These are the 4 changes required to generate core dump
1. Run docker container in privileged mode
2. Add CoreDumpDirectory /tmp in apache2.conf
3. Set core pattern
echo '/tmp/core.%h.%e.%t' > /proc/sys/kernel/core_pattern
4. Set core files to unlimited
ulimit -c unlimited
@nidhi-ag
nidhi-ag / docker-help.md
Last active December 17, 2019 10:23 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@nidhi-ag
nidhi-ag / docker_notes.txt
Created August 4, 2019 06:46 — forked from sd031/docker_notes.txt
Detailed Docker notes from Docker Deep dive course
Course url: https://linuxacademy.com/containers/training/course/name/docker-deep-dive-part-1
==================== All Docker Command While Learning Docker =========================
Get a list of all of the Docker commands:
docker -h
====== Attaching to Container , run in background , name it ==========
Create a container and attach to it:
@nidhi-ag
nidhi-ag / golang - priority queue using heap
Created July 16, 2019 16:29
Implementation of priority queue using heap data structure (without using golang heap interface)
package main
import (
"encoding/json"
"fmt"
)
type Queue []int
var n int
package main
import (
"fmt"
"encoding/json"
)
func maxHeap (input []int) {
l := len(input)
@nidhi-ag
nidhi-ag / xhprof-php7
Created February 3, 2019 07:14
Install XHProf - PHP7
git clone https://github.com/longxinH/xhprof.git ./xhprof
cd xhprof/extension/
phpize
./configure --with-php-config=/usr/local/bin/php-config
make
sudo make install
FROM golang:1.8.5-stretch
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends \
autoconf \
automake \
bzip2 \
dpkg-dev \
file \