Skip to content

Instantly share code, notes, and snippets.

View KTG1's full-sized avatar

Koray Tuğberk GÜBÜR KTG1

View GitHub Profile
@KTG1
KTG1 / serp_heatmap.py
Created October 5, 2022 12:31 — forked from eliasdabbas/serp_heatmap.py
Create a heatmap of SERPs, using a table with columns: "keyword", "rank", and "domain"
import plotly.graph_objects as go
import pandas as pd
def serp_heatmap(df, num_domains=10, select_domain=None):
df = df.rename(columns={'domain': 'displayLink',
'searchTerms': 'keyword'})
top_domains = df['displayLink'].value_counts()[:num_domains].index.tolist()
top_domains = df['displayLink'].value_counts()[:num_domains].index.tolist()
top_df = df[df['displayLink'].isin(top_domains) & df['displayLink'].ne('')]
@KTG1
KTG1 / compress_video.py
Created April 15, 2022 12:18 — forked from ESWZY/compress_video.py
An example Python code for compressing video file to target size.
import os
import ffmpeg
def compress_video(video_full_path, size_upper_bound, two_pass=True, filename_suffix='1'):
"""
Compress video file to max-supported size.
:param video_full_path: the video you want to compress.
:param size_upper_bound: Max video size in KB.
:param two_pass: Set to True to enable two-pass calculation.
:param filename_suffix: Add a suffix for new video.