Skip to content

Instantly share code, notes, and snippets.

View imneonizer's full-sized avatar
:octocat:
Developing for the python community!

Nitin Rai imneonizer

:octocat:
Developing for the python community!
View GitHub Profile

Download from google drive using wget

Set the file to Public, get sharing link and extract FILEID

for small files These can also be directly download by visiting the address or using wget

wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O FILENAME

for large files

// collect images links
function collect(){
images = document.getElementsByClassName("serp-item")
images = Object.keys(images).map(key => JSON.parse(images[key].getAttribute("data-bem"))['serp-item']["img_href"])
return images
}
// returs boolean value to check if page end has reached
function footer_hidden(){
@imneonizer
imneonizer / auto_tmux_attach.sh
Created April 13, 2020 15:16
add this file to ~/.bashrc and when ever you will do a ssh connection / open terminal, a tmux session will automatically created/attached
if (`tmux attach -t backup`) ; then
echo "tmux attach -t backup"
else
echo "tmux new -s backup"
`tmux new -s backup`
fi
@imneonizer
imneonizer / resolve-apt-repo-problem.md
Last active May 14, 2020 05:37
How to resolve apt repository problem on linux
Error: Could not resolve 'bionic' unable to find package

These problems occur when sources repository address is configured wrong.
To fix this problem sudo nano /etc/apt/sources.list find out which repository is causing problem and remove it.

To add add default repositories use below command:

sudo add-apt-repository main
#requirements: requests, pillow, imthread
#usage: python yd-downloader.py -i urls.txt -o images --threads 1000
import requests
from requests import exceptions
from PIL import Image
import os
import time
import argparse
import os
import glob
import shutil
import uuid
class TempFile:
def __init__(self, base_path, ext):
self.path = os.path.normpath("{base_path}/{rand}{ext}".format(
base_path=base_path,
rand=str(uuid.uuid4()),

Block people from accessing internet on your network

Install below package

sudo apt-get install dsniff

Find your interface and router's IP address using ifconfig command
if you are on wifi it is usualy wlan0 and for ethernet eth0. Find the IP address of the device you wish to block internet for and fill in place of CHILD_ADRS below.
Do the same for ROUTER_ADRS.

1. Stop the docker daemon

sudo service docker stop

2. Add a configuration file to tell the docker daemon what is the location of the data directory Using your preferred text editor add a file named daemon.json under the directory /etc/docker.

sudo vim /etc/docker/daemon.json

Install Docker Compose via Python PIP

These are all commands you need to install Docker Compose on a freshly installed NVIDIA Jetson.

# step 1, install Python PIP
$ sudo apt-get update -y
$ sudo apt-get install python3-pip

# step 2, install Docker Compose build dependencies for Ubuntu 18.04 on aarch64
$ sudo apt-get install -y libffi-dev libssl-dev python-openssl
# warning run every command one by one with precautions
# remove nvidia-docker
sudo apt-get purge -y docker-engine docker docker.io docker-ce -y
sudo apt-get autoremove -y --purge docker-engine docker docker.io docker-ce -y
## remove unsed programs
sudo apt-get remove --purge libreoffice* -y
sudo apt-get remove libreoffice-core -y
sudo apt-get remove snapd lightdm cups chromium* -y