Skip to content

Instantly share code, notes, and snippets.

View hayderimran7's full-sized avatar

Imran Hayder hayderimran7

View GitHub Profile
@hayderimran7
hayderimran7 / gist:d1dea1d86c0d04f11b74
Created May 19, 2015 21:21
Awesome grep for .ini or .conf files
awesome grep for ini conf files
grep "^[^#;\[]"
grep -v '^#\|^\s*$'
What does this do?
The above grep will skip all empty lines in a file + skip all lines starting with '#' which usually mean the commented out part of config files..
its great when you are viewing those large never ending openstack oslo config files for like nova , tempest etc..
@hayderimran7
hayderimran7 / remove-non-hidden-only-nix
Created May 19, 2015 21:24
*nix: Remove everything in a folder except hidden files
The following is a nifty command to remove everything in a folder but the hidden files/folders .. Lets say you want to have hidden files , but remove all other data files , helpful when you wana keep info for like .git , .gitignore, .tox, .venv etc etc.. all these hidden files will not get deleted :)
rm -rf `ls -rth | xargs`
@hayderimran7
hayderimran7 / docker-btrfs-ubuntu
Created July 12, 2015 06:13
HOWTO Docker with BTRFS on ubuntu
This is my personal guide on how i setup docker with BTRFS on ubuntu support.
Follow along the steps mentioned as:
1) Make sure you have a separate unmounted partition /dev/sdaX. How I did was , i installed ubuntu on my complete hard drive of 500GB. I wanted to partition it into two, so other 250GB will have btrfs eventually enabled on it. To partition it , after Ubuntu 14 installation, i followed the exact steps as these http://www.howtogeek.com/114503/how-to-resize-your-ubuntu-partitions/.
2) Following the above linked guide, i then managed to have two 250GB , one was spare , other was where UBuntu was installed.
3) login to your ubuntu, now create the btrfs filesystem on the other device. To know which device is it,
install gparted :
> sudo apt-get install gparted
> open it as "gparted"
> this will show u all drives , the ones you are on currently with ubuntu will have label "boot" . now take note of other 250G device.
Mine was /dev/sda3.
@hayderimran7
hayderimran7 / gist:d2e40534016f7f07da44
Created July 12, 2015 06:16
Solve docker issue "Error mounting devices cgroup: mountpoint for devices not found" on ubuntu
I faced this issue when running docker with btrfs. I finally found this link https://www.debian-administration.org/article/696/A_brief_introduction_to_using_docker and solution was at A3.
so perform following as sudo :
> sudo -i
> echo "cgroup /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab
> mount /sys/fs/cgroup
now run docker daemon:
@hayderimran7
hayderimran7 / docker-device-mapper-ubuntu-guide.md
Last active March 10, 2018 11:34
HOWTO Docker run with devicemapper storage on ubuntu

HOWTO: Run docker with devicemapper on Ubuntu 14.04

This write-up is intended to show how docker can be run with devicemapper storage on ubuntu 14.

Steps

  1. Update the kernel on ubuntu 14. Yes, this is required to make docker work with 3.16 kernel version.
sudo apt-get install linux-image-generic-lts-utopic

Background

This POS error with recently happened on a much worse POS system aka OpenSUSE. basically pip was error'ing out for any install i did .

Could not find any downloads that satisfy the requirement

Diagnosis

@hayderimran7
hayderimran7 / firefox-in-docker-container-sles-opensuse.md
Last active August 29, 2015 14:27
Run firefox in docker container based on opensuse /sles

quite an ordeal when working with OS like opensuse. The feeling is mutually shared by father/BDFL of Linux kernel "Linus Torvalds" as he rants about opensuse OS here: https://plus.google.com/+LinusTorvalds/posts/1vyfmNCYpi5

Now that i was trying to install firefox in a opensuse based container: zypper in MozillaFirefox

and also dont forget to install X11 for headless testing of selenium

zypper in xorg-x11-server

@hayderimran7
hayderimran7 / solve_docker_devicemapper_unknown_device.md
Last active November 4, 2015 18:33
How to solve docker driver devicemapper failed to create image rootfs Unknown device when doing a docker commit

How to solve docker driver devicemapper failed to create image rootfs Unknown device when doing a docker commit*

TL;DR:

so in short:

  1. do a docker ps to see which image was this container started from.
  2. do a docker pull of that image.
  3. docker commit of that container, it should work.

Let's say your Docker container exposes the port 8000 and you want access it from your other computers on your LAN. You can do it temporarily, using ssh:

Run following command (and keep it open) to use ssh to forward all accesses to your OSX/Windows box's port 8000 to the Boot2Docker virtual machine's port 8000:

$ boot2docker ssh -vnNTL *:8000:localhost:8000

source : https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md

# create a tinycorelinux fs with custom .tcz packages
# prerequisites: apt-get install squashfs-tools, npm i nugget -g
# dl release + packages (add your packages here)
nugget http://tinycorelinux.net/6.x/x86_64/release/CorePure64-6.3.iso http://tinycorelinux.net/6.x/x86_64/tcz/{pkg-config,make,gcc,gcc_base-dev,gcc_libs-dev,gcc_libs,glibc_base-dev,linux-3.16.2_api_headers,fuse}.tcz -c
# to support compiling addons
unsquashfs -f pkg-config.tcz
unsquashfs -f make.tcz
unsquashfs -f gcc.tcz