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 / 100_base.conf
Created March 14, 2020 05:09 — forked from danackerson/100_base.conf
using nginx + lua + redis for redirects and rewrites
# using such a setup requires `apt-get install lua-nginx-redis` under Ubuntu Trusty
# more info @ http://wiki.nginx.org/HttpLuaModule#access_by_lua
http {
lua_package_path "/etc/nginx/include.d/?.lua;;";
lua_socket_pool_size 100;
lua_socket_connect_timeout 10ms;
lua_socket_read_timeout 10ms;
server {
function parser(url) {
return url.replace(/^\/(.*)$/g, '$1');
}
HOST = 'http://127.0.0.1:8080/';
function get(url = '/get') {
fetch(HOST + parser(url), {
method: 'GET',
}).then((data) => data.json()).then((data) => console.log(data));
@ssi-anik
ssi-anik / server.py
Created January 27, 2020 17:42
Simple Python HTTP Server
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
# Cloned & Updated from: https://gist.github.com/1kastner/e083f9e813c0464e6a2ec8910553e632
import json
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
allow = False
@ssi-anik
ssi-anik / macchange.md
Created December 27, 2019 13:32
Change mac address on ubuntu

change mac address

  • sudo service network-manager stop
  • sudo ifconfig wlp2s0 down
  • sudo macchanger -r wlp2s0
  • sudo ifconfig wlp2s0 up
  • sudo service network-manager restart

restore mac address

  • sudo service network-manager stop
  • sudo ifconfig wlp2s0 down
@ssi-anik
ssi-anik / readme.md
Created November 21, 2019 16:33
bitnami container permission issues
  • Create the directory first mkdir -p ~/.backup/rabbitmq/lumen6
  • provide permission to that directory sudo chown -R 1001:1001 ~/.backup/rabbitmq/lumen6
  • sudo chown anik:anik ~/.backup/rabbitmq/lumen6
  • Run docker-compose up -d --build
@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)
{
@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 / 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 / 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.

@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.