Skip to content

Instantly share code, notes, and snippets.

View ssi-anik's full-sized avatar
💻
Open to remote work!

Syed Sirajul Islam Anik ssi-anik

💻
Open to remote work!
View GitHub Profile
@ssi-anik
ssi-anik / docker-rm-images.md
Last active July 24, 2023 08:33 — forked from alferov/docker-rm-images.md
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")
# Delete unused images
docker system prune --all

MongoDB Practice

MongoDB Exercise in mongo shell

Connect to a running mongo instance, use a database named mongo_practice.

Document all your queries in a javascript file to use as a reference.

Insert Documents

@ssi-anik
ssi-anik / Dockerfile
Created October 10, 2018 18:05
php:7.2-rc-zts-alpine +pthreads +xdebug
FROM php:7.2-rc-zts-alpine
ARG APP_USER_USERNAME=app
RUN apk update && apk add --no-cache \
sudo bash \
g++ make autoconf \
libxml2-dev icu-dev curl-dev pcre-dev
RUN adduser -D -s /bin/bash $APP_USER_USERNAME \
@ssi-anik
ssi-anik / reverse-proxy.go
Created November 6, 2018 10:42
ilanyu/reverse-proxy golang server
package main
import (
"context"
"flag"
"log"
"net"
"net/http"
"net/http/httputil"
"net/url"
@ssi-anik
ssi-anik / git-pull-all.bash
Last active January 9, 2019 10:40
Git pull all
# https://stackoverflow.com/a/17678331/2190689
function git-pull-all() {
START=$(git symbolic-ref --short -q HEAD);
for branch in $(git branch | sed 's/^.//'); do
git checkout $branch;
git pull ${1:-origin} $branch || break;
done;
git checkout $START;
};
@version:3.2
# ===============================================================================================
# Configuration file for syslog-ng, customized for remote logging
# ===============================================================================================
# Options
# Note about $HOST / HOST
# Description: The name of the source host where the message originates from.
# If the message traverses several hosts and the chain_hostnames() option is on, the first host in the chain is used.
# If the keep_hostname() option is disabled (keep_hostname(no)), the value of the $HOST macro will be the DNS hostname of the host that sent the message to syslog-ng OSE (that is, the DNS hostname of the last hop). In this case the $HOST and $HOST_FROM macros will have the same value.
@ssi-anik
ssi-anik / curl.md
Created July 24, 2019 09:44 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ssi-anik
ssi-anik / script.md
Last active May 2, 2022 00:13
[solved][ubunut] Docker API connection refused 127.0.0.1:2376 - docker daemon
  • Create a file on /etc/systemd/system/docker.service.d/startup_options.conf
# /etc/systemd/system/docker.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2376
@ssi-anik
ssi-anik / ConsumerCommand.php
Created September 14, 2019 06:35 — forked from srigi/ConsumerCommand.php
PHP rdkafka
<?php
declare(strict_types = 1);
namespace App\Kafka;
use RdKafka;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@ssi-anik
ssi-anik / createMongoDbLikeId.php
Created November 1, 2019 15:35 — forked from h4cc/createMongoDbLikeId.php
A PHP function to generate IDs like MongoDB uses with its ObjectIDs
<?php
/**
* Creating MongoDB like ObjectIDs.
* Using current timestamp, hostname, processId and a incremting id.
*
* @author Julius Beckmann
*/
function createMongoDbLikeId($timestamp, $hostname, $processId, $id)
{