Skip to content

Instantly share code, notes, and snippets.

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

H.R. Shadhin hrshadhin

🏠
Working from home
View GitHub Profile
@hrshadhin
hrshadhin / Makefile
Created August 16, 2020 15:21
A self-documenting Makefile
.PHONY: help
help: ## Show this help message.
@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
env: ## Setup environment
@echo "Setuping env...."
install: ## Install or update dependencies
@echo "Installing dependencies..."
@hrshadhin
hrshadhin / flask_redis.py
Last active June 24, 2020 14:16
setup [redis](https://pypi.org/project/redis) library with flask using factory pattern or as a flask extension
# create redis extension for flask
import redis
from flask import current_app, _app_ctx_stack
class MyRedis(object):
"""Manage Redis Connection"""
def __init__(self, app=None):
self.app = app
<VirtualHost *:80>
DocumentRoot "/Users/myName/Projects/laravel/public"
ServerName myLaravel.dev
<Directory "/Users/myName/Projects/laravel/public">
AllowOverride All
Options +FollowSymLinks +Indexes
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
@hrshadhin
hrshadhin / Convert Numbers to Words - Bangladesh.php
Created May 18, 2018 13:34 — forked from techjewel/Convert Numbers to Words - Bangladesh.php
Convert Numbers to Words - for Bangladeshi counting system
<?php
/**
* Function: convert_number
*
* Description:
* Converts a given integer (in range [0..1T-1], inclusive) into
* alphabetical format ("one", "two", etc.)
*
* @int
*
@hrshadhin
hrshadhin / 0_webpack_init.txt
Last active April 29, 2018 20:32
webpack init configuration
Below 2 files are needed!
version: '3'
services:
awesome:
image: awesome
ports:
- 8080
environment:
- SERVICE_PORTS=8080
deploy:
=========START==============
#for massive file rename
num=1
for file in $(ls -v *.jpg); do
mv "$file" "$num.jpg"
num=$((num+1))
done
=========END================
@hrshadhin
hrshadhin / how_to_search_on_google
Created March 26, 2018 11:21
how search something on google
http://lmgtfy.com/?q=hrshadhin
@hrshadhin
hrshadhin / windows bootloader recovery
Created March 26, 2018 11:14
How to uninstall GRUB and get windows 7 bootloader back?
How to uninstall GRUB and get windows 7 bootloader back?
========================================================
#Open Up recovary console
>Bootrec.exe /FixMbr
>Bootrec.exe /FixBoot
@hrshadhin
hrshadhin / pwnd.js
Created February 27, 2018 17:29 — forked from jgrahamc/pwnd.js
Cloudflare Workers that adds an "Cf-Password-Pwnd" header to a POST request indicating whether the 'password' field appears in Troy Hunt's database of pwned passwords.
addEventListener('fetch', event => {
event.respondWith(fetchAndCheckPassword(event.request))
})
async function fetchAndCheckPassword(req) {
if (req.method == "POST") {
try {
const post = await req.formData();
const pwd = post.get('password')
const enc = new TextEncoder("utf-8").encode(pwd)