Skip to content

Instantly share code, notes, and snippets.

View dipu-bd's full-sized avatar

Sudipto Chandra dipu-bd

View GitHub Profile
@dipu-bd
dipu-bd / autogen.py
Last active May 2, 2020 23:53
Auto generate LN
import os
import time
PUBLIC_DATA = '/etc/lncrawl/public-data'
novels = []
for user in os.listdir(PUBLIC_DATA):
user_dir = os.path.join(PUBLIC_DATA, user)
if not os.path.isdir(user_dir):
continue
@dipu-bd
dipu-bd / agnoster-minimal.zsh-theme
Created December 12, 2019 11:12
Minimal Agnoster theme for oh-my-zsh with much smaller prefix
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@dipu-bd
dipu-bd / ssh-config.bash
Last active July 12, 2019 14:58
Configure ssh for to use a proxy to connect to target server
Host proxy # A name for the proxy server
Hostname <PROXY_SERVER_IP> # Provide the IP address of the proxy server
User root # The user to connect to in proxy server
Host targetA # A name to access to the Target Server A
ProxyCommand ssh -q proxy nc -q0 <TARGET_A_SERVER_IP> 22
Host targetB # A name to access to the Target Server B
ProxyCommand ssh -q proxy nc -q0 <TARGET_B_SERVER_IP> 22
@dipu-bd
dipu-bd / avatar-gen.py
Created March 19, 2019 07:08
Generate an avatar image from hash of an string
# -*- coding: utf-8 -*-
import sys
import hashlib
import numpy as np
from PIL import Image
from random import randint
def generate(string):
# control variables
Part #1
---------------
base, b1 = 0.70710678118655
height, h1 = 0.29289321881345
Area of single part = 0.20710678118655
Total area of 4 parts = 0.82842712474619
Current PI = 2.82842712474619
Part #2
---------------
@dipu-bd
dipu-bd / pi.cpp
Last active December 29, 2018 11:22
Calculates the value of PI
#include<bits/stdc++.h>
using namespace std;
int main()
{
double b, h, pi;
pi = 2; // area of the rectangle
b = 0.5 * sqrt(2.0); // initial base
for(int i = 2; i <= 25; ++i)
{
@dipu-bd
dipu-bd / stackoverflow_bot.py
Last active November 28, 2018 11:05
Visit stackoverflow everyday to get the Fanatic badge
import time
from os import path
from datetime import datetime
from splinter import Browser
email = "<EMAIL>"
password = "<PASSWORD>"
user_name = "<USER_NAME>"
dir_path = path.dirname(path.realpath(__file__))
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.bangla@1/dist/jquery.bangla.js"></script>
$('#text-area').bangla('toggle'); // toggles the current input mode
$('#text-area').bangla('on'); // enables bangla
$('#text-area').bangla('off'); // disables bangla
$('#text-area').bangla('enable'); // returns the enable status
$('#text-area').bangla('enable', true); // same as .bangla('on')
$('#text-area').bangla('enable', false); // same as .bangla('off')
@dipu-bd
dipu-bd / TitleCase.java
Last active July 26, 2018 00:18
Convert a string to title case in java (with tests).
/*
* Copyright (C) 2018 Sudipto Chandra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of