Skip to content

Instantly share code, notes, and snippets.

View kkumar326's full-sized avatar
🏠
Working from home

Kshitij Kumar kkumar326

🏠
Working from home
  • Bangalore, India
View GitHub Profile
@kkumar326
kkumar326 / nginx.conf
Created January 17, 2020 03:48
Nginx Conf
# nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
@kkumar326
kkumar326 / docker
Created January 22, 2020 04:56
Docker Basic
# Docker Commands
All running containers -> docker ps
All containers -> docker ps -a
All images -> docker images
Pulling image -> docker pull php:5.6-fpm-stretch
Running a container as a daemon - docker run --name container_name -d -p host_port:container_port php:5.6-fpm-stretch
Stopping a container - docker stop container_name
Removing a container - docker rm container_name
Starting a container - docker start container_name
@kkumar326
kkumar326 / logging.php
Created February 19, 2020 07:46
PHP file logging
/*
To ease debugging. Logs data into a file - debug.log in root.
Usage: dlog("w", $var1, "string", 45, true)
Modes: Write and Append
*/
function dlog(string $mode='a', ...$vars) {
if (in_array($mode, ["a", "w"])) {
$fileHandle = @fopen("debug.log", $mode);
if ($fileHandle === FALSE){
@kkumar326
kkumar326 / Makefile
Last active April 19, 2022 06:28
Go Makefile
SERVICE_NAME := global-search-infrastructure
BINARY_NAME := app
ENV := prod dev local
OS = darwin linux windows
ARCHS = 386 amd64
.DEFAULT_GOAL := help
GREEN := $(shell tput -Txterm setaf 2)
@kkumar326
kkumar326 / sshd_config
Created June 18, 2024 04:23
Cloudphant sshd_config for custom server
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.