Skip to content

Instantly share code, notes, and snippets.

View arsho's full-sized avatar

Ahmedur Rahman Shovon arsho

View GitHub Profile
/* Date of execution: Sat 4 May 23:57:05 +06 2019*/
/* Number of questions with Flask tag: 30115 */
SELECT COUNT(Id) FROM Posts WHERE Tags LIKE '%flask%';
/* Number of questions with accepted answer with Flask tag: 15991 */
SELECT COUNT(Id) FROM Posts WHERE Tags LIKE '%flask%' and AcceptedAnswerId IS NULL;
@arsho
arsho / Install_php_mysql_phpmyadmin_ubuntu_18_04.md
Last active February 15, 2023 20:02
Install basic tools in Ubuntu 22.04 LTS. It includes: oh-my-zsh, idle, venv, git, tree, MySQL, PHP, phpMyAdmin.

Install PHP, MySQL, phpMyAdmin in Ubuntu 18.04 LTS

Install Mysql Server and MySQL Client

What is the difference between MySQL Server and MySQL Client?

MySql Client: The mysql-client package allows you to connect to a MySQL server. It will give you the mysql command-line program.

MySql Server: The mysql-server package allows to run a MySQL server which can host multiple databases and process queries on those databases.

  • Update Ubuntu
@arsho
arsho / abc_class_behavior.py
Last active April 29, 2019 16:30
ABC meta class in python
from abc import abstractmethod, ABCMeta
from collections.abc import Container
class ExampleAbstractClass(metaclass=ABCMeta):
@abstractmethod
def first_abstract_method(self, x):
pass
@abstractmethod
@arsho
arsho / rename_srt.py
Last active April 12, 2019 17:38
Rename SRT files to match video files for TV series
import os
import sys
import unittest
import re
from pathlib import Path
import json
class Constants(object):
def __init__(self):
@arsho
arsho / Pycharm_Keyboard_Shortcut.md
Last active May 19, 2019 04:38
Keyboard shortcuts for different IDE : Pycharm , Atom , Netbeans
Function Keyboard shortcut
Open terminal ALT + F12
Switch to editor from terminal ALT + F12
Switch between tabs in editor ALT + < and ALT + >
Go to Line / Column CTRL + G
@arsho
arsho / calculate_without_loop.py
Last active April 2, 2019 16:38
Calculate number of negative values in a list without using any loop
def get_total_negative_numbers(ar):
if not ar:
return 0
ar = sorted(ar)
if ar[0] < 0:
del ar[0]
return 1 + get_total_negative_numbers(ar)
return 0
if __name__ == '__main__':
@arsho
arsho / builtin_method_python.md
Last active April 13, 2023 13:43
Python builtin methods or functions description using Python
  • Example of Python function: int()
  • Show the internal methods of int:
    dir(int)
    
    # Output:
    ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__int__', '__invert__', '__le__', '__lshift__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__trunc__', '__xor__', 'bit_length', 'conjugate', 'denominator', 'from_bytes', 'imag', 'numerator', 'real', 'to_bytes']
    
  • Show the docstring
@arsho
arsho / add_highlightjs_wordpres.md
Last active February 10, 2021 02:00
Add HighlightJS syntax highlighter in Wordpress theme
  • Append the following snippet in functions.php which is used by current theme:
/* Load HighlightJS from CDN */
function add_highlightjs_cdn()
{
	/**
	*      CSS:
	* 		 wp_enqueue_style( $handle, $src, $dependency, $version, $media );
	* JAVASCRIPT:
@arsho
arsho / install_tree.md
Last active March 30, 2020 17:26
Use tree viewer in Ubuntu 16.04 LTS
  • Install tree tool from terminal:
    sudo apt-get install tree
    
  • Go to the desired directory and put tree command:
    tree
    
  • Skip directories or files from lising by using -I 'pattern'
@arsho
arsho / zsh.md
Created March 17, 2019 15:10 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu