Showing posts from 2021

Can't find the code you're looking for? Just Suggest a Snippet and I'll add it :)

Permanently automatically answer 'Yes' when using apt-get install - installing packages

Open your bashrc file sudo nano .bashrc 2. add the following alias apt-get='apt-get -y' And that's it. never have to press 'Y' when installing things again!


Remove https www from domain or URL string in Google Sheets



Executing Shell Commands with Python within a script

import os os.system("your_command_here")


Multi threading Python simple example

from multiprocessing import Pool def f(x): return x * x if __name__ == '__main__': with Pool(50) as p: print(, [1, 2, 3, 2, 4, 5, 6, 7, 8, 9, 19]))


add space between lines of text HTML CSS

Use line height - css line-height: 0.7;


Setup Jenkins on Ubuntu 18.04 on AWS Lightsail

I couldn't find a guide for this - and I had to do this recently. So here goes! 1. Install Java sudo apt update && sudo apt install -y openjdk-8-jdk 2. Add the Jenkins Debian repository wget -q -O - | sudo apt-key add - 3. Add the repo to system sudo sh -c 'echo deb binary/ > /etc/apt/sources.list.d/jenkins.list' 4. Install Jenkins sudo apt update sudo apt install jenkins systemctl status jenkins 5. Add firewall rule In AWS lightsail > click on instance


Multi Line Comments Python

Multi Line Comments """ This is a comment This is a comment """


python print

python print print("Hi")


Commenting in Python

#This is a comment


Big list of selenium options + injecting cookies for testing

Use these options as you need! import csv import random import time from import Options from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException import pickle option = Options() # option.add_argument("headless") # option.add_argument("window-size=1980,960") # option.add_argument("screenshot") # option.add_argument( # "user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36") # option.add_argument("--enable-javascript") # option.add_argument("--disable-infobars") # option.add_argument("start-maximized") # option.add_argument("--disable-extensions") # option.add_argument("--start-maximized") # option.add_argument(&quo


Iterate or go through all files in a directory python

TEXT import os from tqdm import tqdm for filename in tqdm(os.listdir(directory)): if filename.endswith(".csv"): fp = os.path.join(directory, filename)


Deduplicate files all folders ubuntu

Use the awesome fdupes package: fdupes --noprompt -d -r ~/folder


Python requests passing JSON data (for API) boilerplate

Python requests passing JSON data (for API) boilerplate import requests payload = {'key1': 'value1', 'key2': 'value2'} r = requests.get('', params=payload)


Python requests

Python requests boilerplate import requests url = 'URL_HERE' response = requests.get(url) print(url.status_code) content = response.content print(content)


Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu