Skip to content

Instantly share code, notes, and snippets.

View nkpro2000sr's full-sized avatar
🤔
Developing my project

NAVEEN S R nkpro2000sr

🤔
Developing my project
View GitHub Profile
@nkpro2000sr
nkpro2000sr / YT-Download.py
Last active March 21, 2021 11:54
To Download Videos from your youtube private playlist.
import pafy # pip install pafy youtube-dl
def download(video_ids, video=True, audio=False):
"""To download the videos from playlist
Args:-
video_ids : list(str) = List of video ids has to be downloaded
video : bool = Enable to download video
audio : bool = Enable to download audio
"""
for i, video_id in enumerate(video_ids):
@nkpro2000sr
nkpro2000sr / Cythoniz.md
Last active May 3, 2020 18:26
CythonCode.pyx => CCode.c => CObject.o => Exe.so ( still needs libpythonx.x to execute :( )

To generate C code (cycode.c) from Cython code (cycode.pyx)

echo cycode | make cycode.c

To generate Executable (cycode)

echo cycode | make

Now cycode is the Executable.

@nkpro2000sr
nkpro2000sr / ServeoinLocal.sh
Last active May 3, 2020 07:49
To run Serveo Server in local machine
if [ -z "$1" ]
then
wget https://github.com/nkpro2000/For-nkpro2000sr/raw/master/repos/serveo-linux-amd64
serveo=serveo-linux-amd64
else
serveo="$1"
fi
sudo ./${serveo} -port 2222 -private_key_path /etc/ssh/ssh_host_rsa_key
@nkpro2000sr
nkpro2000sr / .tmux.conf
Last active April 6, 2020 11:33
My config for TMUX.
# remap prefix from 'C-b' to 'C-a' and 'C-/'
unbind 'C-b'
set-option -g prefix 'C-a'
bind-key 'C-a' send-prefix
# split panes using | and \
unbind '"'
unbind '%'
bind '|' split-window -h
bind '\' split-window -v
@nkpro2000sr
nkpro2000sr / telecaller.py
Last active March 31, 2020 13:12
To call called function in another interpreter (or anyother) and return returned.
class TeleCaller:
"""It is usefull for calling the called function in another interperter.
Args:
prefix (list): prefix to the call_string
modules (list): modules needed to import, added like "import module1, module2, ... ;"
before call_string.
encoder : passes through before calling
decoder : passed through before returning
Example:
@nkpro2000sr
nkpro2000sr / powershellist.ps1
Last active April 8, 2020 17:22
List of Command Line tools for Windows.
# To install Chocolatey (cli pkgmgr)
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
@nkpro2000sr
nkpro2000sr / brew_setup.sh
Last active March 28, 2020 13:12
To setup brew (a package manager for both MacOs and Linux)
git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew
mkdir ~/.linuxbrew/bin
ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin
eval $(~/.linuxbrew/bin/brew shellenv)
echo 'you can manually setup brew envs using this command (For each terminal session)'
echo 'eval $(~/.linuxbrew/bin/brew shellenv)'
echo '#brew{' >> .bashrc
echo 'eval $(~/.linuxbrew/bin/brew shellenv)' >> .bashrc
# to uninstall brew
echo 'brew-uninstall () {' >> ~/.bashrc
@nkpro2000sr
nkpro2000sr / terminalist.sh
Last active August 1, 2020 14:04
list of useful cammands and alias for terminal.
curl -s "http://worldtimeapi.org/api/timezone/Asia/Kolkata" | cut -d'"' -f34 # alternative to `date`
curl -s ifconfig.co/json | jq # to find your public IP
perl -nle 'print $& while m/[[:print:]]{4,}/g' binary_input # perl version of strings command
curl -L bit.ly/setup-pyenv | sh # to setup pyenv as py
curl -L bit.ly/setup-brew | sh # to setup brew
alias pi='ping 8.8.8.8 | less +F' # ^c + q to exit
alias br='sudo nano /sys/class/backlight/*/brightness' # to change brightness
alias dt='date +"%d[%a]/%m[%b]/%Y %H[%I%p]:%M:%S"' # just Date and Time
alias lslck='sudo ls /var/lib/*/*.lck' # to list all locks
@nkpro2000sr
nkpro2000sr / free_server.py
Last active March 20, 2020 05:28
host free server using python anywhere. but only one port ("user_name.pythonanywhere.com",80)
import requests # only these [urls](www.pythonanywhere.com/whitelist/) are allowed
def get_content(path):
" Do whatever with `path` and generate `content` "
return content
def application(environ, start_response):
path = environ.get('PATH_INFO')
content = get_content(path)
if content == None :
status = '404 NOT FOUND'
@nkpro2000sr
nkpro2000sr / pyenv_setup.sh
Last active March 28, 2020 13:11
to setup pyenv and pyenv-virtualenv in linux. pyenv lets you easily switch between multiple versions of Python.
# pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
# pyenv-virtualenv
git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
# pyenv-pip-migrate
git clone git://github.com/pyenv/pyenv-pip-migrate.git ~/.pyenv/plugins/pyenv-pip-migrate
# pyenv-update
git clone https://github.com/pyenv/pyenv-update.git ~/.pyenv/plugins/pyenv-update
# adding pyenv to environment
echo '#pyenv{' >> ~/.bashrc