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 os | |
import requests | |
import mwclient | |
import pandas as pd | |
category_names = ['Computer_hardware', 'Data_centers', 'Servers', | |
'Control_rooms', 'Floppy_disk_drives', 'Hard_disks', | |
'Automobile_dashboards', 'Old_maps', 'Laboratory_equipment'] |
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 os | |
import random | |
from PIL import Image, ImageOps | |
def concat_images(image_paths, size, shape=None): | |
# Open images and resize them | |
width, height = size | |
images = map(Image.open, image_paths) | |
images = [ImageOps.fit(image, size, Image.ANTIALIAS) |
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 requests | |
import datetime | |
import pandas as pd | |
import json | |
import time | |
# Read rescuetime key | |
with open('key.txt', 'r') as f: | |
key = f.read() |
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 nbformat | |
filepath = 'notebbook.ipynb' | |
with open(filepath, 'r', encoding='utf-8') as f: | |
nb = nbformat.read(f, as_version=4) | |
wc_markdown, wc_heading, wc_code = 0, 0, 0 | |
for cell in nb.cells: | |
if cell.cell_type == "markdown": | |
wc_markdown += len(cell['source'].replace('#', '').lstrip().split(' ')) |
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 | |
from watchdog.observers import Observer | |
from watchdog.events import FileSystemEventHandler | |
class EventHandler(FileSystemEventHandler): | |
def on_any_event(self, event): | |
print("EVENT") | |
print(event.event_type) | |
print(event.src_path) | |
print() |
This is a collection of useful ffmpeg commands. Detailed description of the commands can be found in the documentation
Extract frames from video, one frame per second, where -r
sets the desired framerate (e.g. -r 10
extracts 10 frames per second).
ffmpeg -i movie.mp4 -r 1 frames\\frame_%%04d.png
Create Instagram compatible video from frames
NewerOlder