Skip to content

Instantly share code, notes, and snippets.

View rahulhaque's full-sized avatar
🐢
🐘 🐍 🐬 :atom: 🌱

rahulhaque rahulhaque

🐢
🐘 🐍 🐬 :atom: 🌱
View GitHub Profile
@rahulhaque
rahulhaque / traefik_setup.md
Last active September 9, 2023 04:57
Setup Traefik in a minute

Setup Traefik in a Minute

This setup procedure is only for local environment

  1. Create a config file in home ~/.traefik/traefik.yml and copy paste the following content there.
global:
  checkNewVersion: true
  sendAnonymousUsage: false
@rahulhaque
rahulhaque / tilix_setup.md
Last active November 17, 2022 17:16
Tilix in IntelliJ

IntelliJ (PHPStorm, WebStorm, Pycharm etc.)

Requirments

  • zsh

Setup

Go to File->Settings->Tools->Terminal and add below line in Shell path

# To start default Tilix in project directory
/usr/bin/zsh -i -c "nohup tilix >/dev/null 2>&1 &"
@rahulhaque
rahulhaque / cmder_setup.md
Last active November 17, 2022 16:50
Cmder in VS Code / IntelliJ

VS Code

Add below lines in settings.json

{
  "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
  "terminal.integrated.shellArgs.windows": ["/k C:\\Cmder\\vendor\\init.bat"]
}

IntelliJ (PHPStorm, WebStorm, Pycharm etc.)

@rahulhaque
rahulhaque / container.php
Created July 20, 2021 08:16 — forked from tlikai/container.php
PHP Dependency Injection Container
<?php
class Container
{
protected $setings = array();
public function set($abstract, $concrete = null)
{
if ($concrete === null) {
$concrete = $abstract;
@rahulhaque
rahulhaque / cli_server_quickstart.md
Last active July 2, 2022 17:39
CLI Server Setup Guide

Server Configuration Steps (Quickstart)

We all get to work with Linux servers at sometime of our development career. Configuring a newly obtained CLI server (such as - linode, digitalocean, vultr etc.) can be confusing for the new comers as well as one who already knows how to configure one. Here I will try to discuss the steps to go along while configuring a fresh server.

Setup User

If its a new server and you have access to the server as a root user, then you should add a new user which will prevent direct root access.

adduser 
@rahulhaque
rahulhaque / example.js
Created November 19, 2020 07:13
Leaflet to support custom headers. Credit - https://github.com/ticinum-aerospace/leaflet-wms-header
L.TileLayer(MAP_URL, {
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a>',
}, [
{header: 'Authorization', value: ACCESS_TOKEN}
], null).addTo(map);
@rahulhaque
rahulhaque / delete-files.php
Created November 12, 2020 10:10
Simple helper function to delete matching files using PHP
<?php
/**
* Delete a file or matching files.
*
* @example deleteFile('/file-path/some-name-*.*');
*
* @param string $filename
* @return array
*/
@rahulhaque
rahulhaque / CustomWebsocketOneController.php
Created June 25, 2020 10:56
Ratchet Websocket Server Routing Example Laravel
<?php
namespace App\Http\Controllers;
use Ratchet\ConnectionInterface;
use Ratchet\WebSocket\MessageComponentInterface;
use React\EventLoop\LoopInterface;
use SplObjectStorage;
class CustomWebsocketOneController implements MessageComponentInterface
@rahulhaque
rahulhaque / world-currencies-array-of-array.php
Created September 28, 2018 06:21
World currencies in a single array of arrays. Source - https://www.currency-iso.org
<?php
[
[
"currency_code" => "AFN",
"currency_name" => "Afghani",
"country" => "AFGHANISTAN"
],
[
"currency_code" => "EUR",
// Datetimepicker format sheet for -
// https://eonasdan.github.io/bootstrap-datetimepicker/
// Vanilla datetimepicker
$('.datetimepicker').datetimepicker({
format: 'YYYY-MM-DD LT',
defaultDate: moment().toISOString()
});
// Only datepicker