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 time | |
import multiprocessing | |
import threading | |
from concurrent.futures import ThreadPoolExecutor | |
def cpu_bound_task(n): | |
"""A CPU-bound task that calculates the sum of squares.""" | |
return sum(i * i for i in range(n)) |
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
const userIdsToBlock = [ | |
'1761800633500188672', | |
'1234567890123456789', | |
'9876543210987654321' | |
]; | |
// Function to block a single user | |
async function blockUser(userId) { | |
const url = "https://x.com/i/api/1.1/blocks/create.json"; | |
const headers = { |
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
# add this to your kitty config: `~/.config/kitty/kitty.conf` | |
map ctrl+g kitten hints --type=linenum --regex='(?P<path>\/.*?\.[\w:]+)",\sline\s(?P<line>\d*)' --program='tab nvim +{line} {path}' |
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
using System; | |
using System.Net.Http; | |
using System.Text; | |
using System.Threading.Tasks; | |
class Program | |
{ | |
static async Task Main() | |
{ | |
await FetchDataFromGraphQL(); |
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
const endpointUrl = 'https://api.petroly.co/'; | |
const graphqlQuery = ` | |
{ | |
search(term: "202320", department: "ICS", title: "") | |
} | |
`; | |
fetch(endpointUrl, { | |
method: 'POST', |
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 subprocess | |
def reduce_video_quality( | |
input_file, | |
output_file, | |
target_resolution=(640, 360), | |
target_fps=30, | |
target_bitrate="1500k", | |
): |
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
from PIL import Image | |
import os | |
import glob | |
def resize_and_reduce_quality(input_dir, output_dir, max_size, quality): | |
if not os.path.exists(output_dir): | |
os.makedirs(output_dir) | |
for filename in os.listdir(input_dir): |
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
from moviepy.editor import VideoFileClip | |
def convert_mov_to_mp4(input_file, output_file): | |
try: | |
video_clip = VideoFileClip(input_file, target_resolution=(1920, 1080)) | |
video_clip.write_videofile( | |
output_file, | |
codec="libx264", | |
audio_codec="aac", |
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 random | |
def read_csv(file_path): | |
with open(file_path, "r") as file: | |
lines = file.readlines() | |
rows = [line.strip().split(",") for line in lines] | |
return rows |