This file contains hidden or 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
pip install moviepy | |
from moviepy.editor import VideoFileClip | |
# Define the path to the video file | |
video_path = "path/to/video/file.mp4" | |
# Create a VideoFileClip object | |
video_clip = VideoFileClip(video_path) |
This file contains hidden or 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
pip install instaloader | |
import instaloader | |
# Create an instance of Instaloader | |
loader = instaloader.Instaloader() | |
# Define the target Instagram profile | |
target_profile = "instagram" |
This file contains hidden or 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
pip install googlesearch-python | |
from googlesearch import search | |
# Define the query you want to search | |
query = "Python programming" | |
# Specify the number of search results you want to retrieve | |
num_results = 5 |
This file contains hidden or 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
pip install pywhatkit | |
import pywhatkit | |
# Set the target phone number (with country code) and the message | |
phone_number = "+1234567890" | |
message = "Hello, this is an automated WhatsApp message!" | |
# Schedule the message to be sent at a specific time (24-hour format) | |
hour = 13 |
This file contains hidden or 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
pip install pytube | |
from pytube import YouTube | |
# Specify the URL of the YouTube video | |
video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" | |
# Create a YouTube object | |
yt = YouTube(video_url) |
This file contains hidden or 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
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
This file contains hidden or 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
# app/management/commands/routes.py | |
from django.core.management import BaseCommand | |
from django.urls import resolvers, URLResolver, URLPattern | |
class Command(BaseCommand): | |
""" | |
Show routes list | |
""" |
This file contains hidden or 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
// HTTP service http.js | |
axios.interceptors.response.use(response => { | |
return response | |
}, error => { | |
if (error.response.status === 401) { | |
bus.$emit('errors:401') | |
return Promise.reject() | |
} else { | |
bus.$emit('error', error.response.data) | |
return Promise.reject() |
This file contains hidden or 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
# enable_pgcrypto_extension.rb | |
class EnablePgcryptoExtension < ActiveRecord::Migration[5.1] | |
def change | |
enable_extension 'pgcrypto' | |
end | |
end | |
# config/application.rb | |
config.generators do |g| | |
g.orm :active_record, primary_key_type: :uuid |
This file contains hidden or 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
func searchBar(searchBar: UISearchBar, textDidChange searchText: String) { | |
weak var weakSelf: ProductPickerTableViewController = self | |
var searchDelay: Double = 0.3 | |
if self.searchBlock != nil { | |
//We cancel the currently scheduled block | |
cancel_block(self.searchBlock) | |
} | |
self.searchBlock = dispatch_after_delay(searchDelay, {() -> Void in | |
//We "enqueue" this block with a certain delay. It will be canceled if the user types faster than the delay, otherwise it will be executed after the specified delay |
NewerOlder