Skip to content

Instantly share code, notes, and snippets.

@misraX
misraX / docker-install-debian.sh
Last active August 11, 2017 12:06
Installing docker in Debian amd64 using the official method
#!/bin/bash
# installing dependencies
apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
# Adding docker keys to apt-keys
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
# Verifying the docker figerprint
apt-key fingerprint 0EBFCD88
@misraX
misraX / pip-freezeWrapper.sh
Last active March 5, 2025 15:46
Bash Script To Install Python Packages and Generate requirements.txt Inside Python Virtualenv.
#!/bin/bash
#
# Created By: misraX
# Github: github.com/misrax
# License: MIT
# CopyWrite: 2017
# Bash script to install and generate pip requirements.txt from inside a virtualenv.
# By using pip freeze to creat a list of all the virtualenviroment pip packeges.
# It's just a simple way of creating the pip requirements.txt for a development use.
# usage pip-install package1 package2 package3 .. package(n)... etc
replace all home/user --> vim way: home\/user\/
to --> vim way: /
var/www/example.com/public_html --> vim way: var\/ww\/example.com\/public_html\/
all --> vim way: /g
will be:
:%s/home\/user\//var\/www\/example.com\/public_html\//g
@misraX
misraX / cpu-frequency-control.sh
Last active August 11, 2017 12:08
Kernel cpu frequency control to lower the power consumtion and fans noise without the need to set up the frequency limits using BIOS settings.
#!/bin/bash
# Created By: misraX
# Github: github.com/misrax
# License: MIT
# CopyWrite: 2017
# A very basic shell script.
# Tested in archlinux
# kernel: 4.11.9-1-ARCH, cpupower: 4.12-1, bash: 4.4.12
# To control the frequency of my Lynnfield Core i5 760 CPU. In a very hot weather :D
#!/bin/bash
ps aux | grep -e "docker" | awk '{ print $2 }'
#!bin/bash
docker stop $(echo $(docker container ps | awk '
{
i = 1
# ingore CONTAINER ID from the output
if ( ! /^CONT/ )
{
print $i
}
@misraX
misraX / PKGBUILD
Last active July 4, 2017 04:00 — forked from DeadMetaler/PKGBUILD
pkgname=mutter
pkgver=3.24.1+2+gbb481fafd
pkgrel=1
pkgdesc="A window manager for GNOME"
url="https://git.gnome.org/browse/mutter"
arch=(i686 x86_64)
license=(GPL)
depends=(dconf gobject-introspection-runtime gsettings-desktop-schemas
libcanberra startup-notification zenity libsm gnome-desktop upower
libxkbcommon-x11 gnome-settings-daemon libgudev libinput)
@misraX
misraX / exposing-TCP-Ports-iptables.sh
Last active August 11, 2017 12:10
Exposing Docker ports to host machine using iptables.
#!/bin/bash
ip=172.17.0.2
port=8080
iptables -t nat -A DOCKER -p tcp --dport $(port) -j DNAT --to-destination $(ip):$(port)
@misraX
misraX / docker-socat.sh
Last active August 11, 2017 12:11
Exposing TCP Ports Using Socat's Container
#!/bin/bash
###
# socat container to forward tcp ports from system wide running containers or network services
###
# Define the ip
ip=172.17.0.2
# Define port number
port=8080
#!/bin/sh
#####
#mmm, misraX
##### Automatically stop all docker containers ##########
# Loop over containeres, awk the first col "CONTAINER"
# exclude the string that start with ! /CONT/ to exclude CONTAINER ID
# as it's an invalid container ID.
for i in $(docker ps | awk '! /CONT/ {print $1}')
do