This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.....[copy from local to vps using ssh] | |
sudo scp file_name user@ip:/home/$USER/ | |
.....[copy from vps to local using rsync excluding .git folder] | |
rsync -av -e ssh --exclude='.git' cds@cdsapply.com:/home/cds/cds2_cockpitBackend/ /home/wildonion/Documents/cds_backend_backup | |
.....[jekyll installation] | |
https://jekyllrb.com/docs/installation/ubuntu/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read TPdevice <<< $( xinput | sed -nre '/TouchPad|Touchpad/s/.*id=([0-9]*).*/\1/p' ) # getting the id of the touchpad device | |
state=$( xinput list-props "$TPdevice" | grep "Device Enabled" | grep -o "[01]$" ) # getting the status of touchpad | |
if [ "$state" -eq '1' ];then | |
xinput --disable "$TPdevice" && notify-send -i emblem-nowrite "Touchpad" "Disabled" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import math | |
# lambda complex syntax | |
print((lambda name, number: str(number)+name)(input("[+] Enter A Name : "), 456)) | |
# ===================================== | |
# overloading * operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ===================================== | |
# calculate all possible subset for a set | |
# base prespective for n nested loop and other dynamic problems! | |
# for i in [0..2]: | |
# for j in [0..2]: | |
# for p in [0..2]: | |
# for q in [0..2]: | |
# 0 0 0 0 -> 0 0 0 2 -> 0 0 1 0 -> 0 0 1 2 | |
# 0000, 0001, 0002, 0010, 0011, 0012, 0020, ..., 2222, (1)0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# >>> d={"adventurous":"aventurero","bold":"audaz","courageous":"valiente"} | |
# >>>d.items() | |
# [('courageous', 'valiente'), ('adventurous', 'aventurero'), ('bold', 'audaz')] | |
# >>> d.keys() | |
# ['courageous', 'adventurous', 'bold'] | |
# >>> d.values() | |
# ['valiente', 'aventurero', 'audaz'] | |
# >>> my_list = [('a', 1), ('b', 2)] | |
# >>> dict(my_list) | |
# {'a': 1, 'b': 2} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Callable | |
# topol algo | |
tsbst: list = [None] | |
def subset(sett: list) -> list: | |
biN:Callable[str, str] = lambda el : ''.join(reversed([str((el>>i) & 1) for i in range(len(sett))])) | |
tpx:int = 2**len(sett) | |
for i in range(1,tpx): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------------------------------------- | |
# designing pattern on a simple OOP problem | |
# employees insured and salary | |
employees = [] | |
# ====================================== | |
# CLASSES | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ACTIVITY PROBLEMS | |
# given a set of n activities with their start and finish times, | |
# we need to select maximum number of non-conflicting activities | |
# that can be performed by a single person, | |
# given that the person can handle only one activity at a time. | |
activities = [(1, 3), (3, 4), (2, 5), (0, 7), (5, 9), (8, 10), (11, 12)] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# longest substring without repeating characters | |
class lols: | |
def __init__(self, string : str): | |
self.string = string | |
def solve(self) -> int: | |
if len(self.string) == 0: | |
return 0 | |
if len({self.string[i] : i for i in range(len(self.string))}) == 1: | |
return 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
# unhappy friends | |
# https://leetcode.com/contest/weekly-contest-206/problems/count-unhappy-friends/ | |
# eg ::: input: [[1, 3, 2], [2, 3, 0], [1, 3, 0], [0, 2, 1]], pairs = [[1, 3], [0, 2]], output: 4 | |
if __name__ == "__main__": | |
f_n = int(input("Enter friends ::: ")) | |
if 2 <= f_n <= 500 and f_n % 2 == 0: | |
preferences = [] |
OlderNewer