Skip to content

Instantly share code, notes, and snippets.

@haisum
haisum / Docker-getting-started.md
Created October 27, 2024 18:17
Docker Wokshop from Docker docs in Notebook Format

Docker Workshop

Setup

This workshop markdown file is based on https://docs.runme.dev/. So if it does not appear as a workflow in your editor, kindly install VSCode and setup runme extension as described here: https://docs.runme.dev/getting-started/vscode. Then it should appear similar to a Jupyter Notebook you would see in a Python tutorial.

Workshop Goals

In this workshop, we will:

@haisum
haisum / docker_dedicated_filesystem.md
Created July 20, 2020 15:30 — forked from hopeseekr/docker_dedicated_filesystem.md
Putting Docker on its own pseudo filesystem

Docker on BTRFS is very buggy and can result in a fully-unusable system, in that it will completely butcher the underlying BTRFS filesystem in such a way that it uses far more disk space than it needs and can get into a state where it cannot even delete any image, requiring one to take drastic actions up to and including reformatting the entire affected BTRFS root file system.

According to the official Docker documentation:

btrfs requires a dedicated block storage device such as a physical disk. This block device must be formatted for Btrfs and mounted into /var/lib/docker/.

In my experience, you will still run into issues even if you use a dedicated partition. No, it seems it requires a standalone

@haisum
haisum / UploadedFile.class.php
Created July 23, 2019 20:42
PHP verify uploaded file class
<?php
/**
* CUploadedFile class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2013 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
@haisum
haisum / Db.class.php
Created July 23, 2019 20:38
mysql master/slave db connection class php
<?php
/**
* Class for executing and logging queries on Tradebanq.com database
* @author Haisum <haisumbhatti@gmail.com>
*/
class TradeBanqDb {
/**
* stores link returned from mysql_connect from master
* on execution of first DML query
* @var mysql
@haisum
haisum / Html.class.php
Created July 23, 2019 20:35
Modified Non Yii Html class
<?php
/**
* Html class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2013 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
@haisum
haisum / yumdownload.sh
Created June 28, 2018 13:37
yum download all dependencies
#install downloadonly yum plugin
sudo yum --enablerepo=mariadb install --installroot=`pwd` --releasever=/ --downloadonly --downloaddir=./ MariaDB-client
@haisum
haisum / ldap_tshark.sh
Created May 18, 2018 01:32
Capture ldap packets with tshark
tshark -i any -2 -R ldap.filter -f "dst port 389" -O ldap -V
@haisum
haisum / pprof.go
Created November 6, 2017 14:36
Go memory/cpu analysis
//run two servers:
go func() {
err := proxy.Start(viper.GetString("PROXY_URL"),
viper.GetString("PROXY_SUFFIX"),
viper.GetString("DATA_DIR"),
viper.GetString("HTTP_HOST"),
viper.GetInt("HTTP_PORT"))
if err != nil {
log.WithError(err).Fatal("Error happened in starting proxy server.")
@haisum
haisum / equiv-binary-go-tour.go
Created August 28, 2017 20:51
equivalent binary trees
package main
import (
"golang.org/x/tour/tree"
"fmt"
"time"
)
// Walk walks the tree t sending all values
// from the tree to the channel ch.
@haisum
haisum / redirects.js
Created August 10, 2017 12:18
Phantomjs redirects handling
function renderPage(url) {
var page = require('webpage').create();
var redirectURL = null;
page.onResourceReceived = function(resource) {
if (url == resource.url && resource.redirectURL) {
redirectURL = resource.redirectURL;
}
};