Skip to content

Instantly share code, notes, and snippets.

View sabuhish's full-sized avatar
💭
Pythonic, Linux lover

Sabuhi sabuhish

💭
Pythonic, Linux lover
  • Baku Azerbaijan
View GitHub Profile
arr = [3,4,6,7,14,52]
def binary_search(arr,reqem):
left =0
right = len(arr) -1
while left<=right:
m = (left+right)//2
@sabuhish
sabuhish / basic-mongo-queries.js
Created April 11, 2020 15:27 — forked from dipaktelangre/basic-mongo-queries.js
MongoDB: Indexing - Create, Update, Delete and Analyze MongoDb Indexes
//show databases
show dbs
//Use Database test
use test
// show collections from the database
show collections
// show counts of records in collection
from motor.motor_asyncio import AsyncIOMotorClient
from bson.objectid import ObjectId
from bson.json_util import loads as bson_loads, dumps as bson_dumps
import asyncio
import pprint
from pymongo import ReturnDocument
import json
loop = asyncio.get_event_loop()
arr = [99,85,75,46,45,8,3,93,68,49,34,78,28,66,97,58,100,4,22,74,79,26,94,52,13,39,90,60,10,36,55,7,54,25,1,47,31,3,88,2,84,14,21,9,86,70,65,71,56,6,32,88,7,69,44,89,67,98,29,16,61,5,43,63,33,92,35,50,76,37,42,59,15,80,96,48,24,64,11, 62,27,23,20,40,53,30,57,19]
class InsertionSort:
def __init__(self, arr: list):
self.arr = arr
def insertion(self) -> list:
# version: '3.7'
# services:
# localstack:
# container_name: my-localstack
# privileged: true
# image: localstack/localstack
# ports:
# - "4567-4593:4567-4593"
# - "${PORT_WEB_UI-7777}:${PORT_WEB_UI-7777}"
@sabuhish
sabuhish / gist:f994c41f4e0b00366408b5a064675701
Created February 14, 2020 09:35 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
adduser your_username
usermod -aG sudo your_username >> add user to sudo user group
type >> visudo
add this below to the file:
your_username ALL=(ALL) ALL
install docker:
curl https://get.docker.com | sh
sudo usermod -aG docker $(whoami)
docker --info
docker --version
CREATE USER "username" WITH PASSWORD "your_pass" WITH ALL PRIVILEGES
set password for "username" = "pass"
show databases;
use db_name
show measurements
@sabuhish
sabuhish / executable sh script
Last active April 14, 2020 06:27
executable sh script
chmod +x filename
sudo mv /usr/local/bin
chmod 400 file To protect a file against accidental overwriting.
chmod 500 directory To protect yourself from accidentally removing, renaming or moving files from this directory.
chmod 600 file A private file only changeable by the user who entered this command.
chmod 644 file A publicly readable file that can only be changed by the issuing user.
chmod 660 file Users belonging to your group can change this file, others don't have any access to it at all.
chmod 700 file Protects a file against any access from other users, while the issuing user still has full access.