Skip to content

Instantly share code, notes, and snippets.

@misraX
misraX / ignoredfolders
Last active February 21, 2017 02:39
Bash script to remove folders recursively from git cached
#!/bin/bash
for i in $(cat .gitignore); do echo $i && git rm -rf --cached $i; done
function showElementsOnClient(elements){
// Select Elements.
var selectedElements = document.querySelectorAll(elements);
// looping through the querySelectorAll NodeList[selectedElements_lenght]
for (i in selectedElements){
// defining selectedElements into the countedElements
var countedElements = selectedElements[i].innerText;
# coding: utf-8
import os
base_dir = os.walk("/dir_path")
for root, directory, files in base_dir:
for filename in files:
filepath = os.path.join(root, filename)
print (filepath)
for files in *.mp3; do echo ${files}>>00\ ALBUMNAME.m3u; done
#!/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
@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
@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 / 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)
#!bin/bash
docker stop $(echo $(docker container ps | awk '
{
i = 1
# ingore CONTAINER ID from the output
if ( ! /^CONT/ )
{
print $i
}
#!/bin/bash
ps aux | grep -e "docker" | awk '{ print $2 }'