Skip to content

Instantly share code, notes, and snippets.

View erfan-rfmhr's full-sized avatar
😶
working

Erfan Arefmehr erfan-rfmhr

😶
working
View GitHub Profile
from tkinter import *
import ctypes
import random
import tkinter
# For a sharper window
# ctypes.windll.shcore.SetProcessDpiAwareness(1)
# Setup
root = Tk()
@ArmanTaheriGhaleTaki
ArmanTaheriGhaleTaki / automatic_FFMPEG_script
Created July 29, 2022 04:03
this is a bash script that compress MP4 formatted videos in a folder automatically and name the output as [Videoname] _compressed.mp4
#!/bin/bash
VIDEOS=$(ls *.mp4)
for VIDEO in $VIDEOS
do
ffmpeg -i $VIDEO -vcodec libx265 -crf 28 -f mp4 ${VIDEO%%.*}_compressed.mp4
done
@ArmanTaheriGhaleTaki
ArmanTaheriGhaleTaki / ffmpegautomate.cpp
Last active June 5, 2023 09:07
automation of the process of the naming the output file
#include <iostream>
#include <sys/stat.h>
#include <fstream>
void compress( char** input);
unsigned long long int fileSize(std::string fileNameWithextensionSTR);
void diffsize(std::string fileNameWithextensionSTR1,std::string fileNameWithextensionSTR2);
inline bool IsMP4FileExists (const std::string& name);
using namespace std;
int *argcGlobal=0;
int main(int argc, char **argv) {
@anand2312
anand2312 / pymongo-to-motor.md
Last active April 11, 2025 18:01
pymongo vs Motor

pymongo vs Motor

Motor is an async Python driver for MongoDB.

When should I use Motor?

You should use Motor when you're trying to interact with a MongoDB database in an asynchronous context. When you're making something that needs to be asynchronous (like a web server, or most commonly from what I've seen here, Discord bots), you also want all the database calls to be done asynchronously. But pymongo is synchronous, i.e it is blocking, and will block the execution of your asynchronous program for the time that it is talking to the database.

Okay, How do I switch now?!

Thankfully for us, switching from pymongo to Motor isn't too hard, and won't need you to change much code. This process can be roughly summarized as:

Step 1: Install Motor, and import it

Installing can be done with pip - pip install motor

@ECHO OFF
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
:CONFIRM
echo Are you sure to lock this folder? (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
@luismts
luismts / GitCommitBestPractices.md
Last active July 19, 2025 20:35
Git Tips and Git Commit Best Practices

Git Commit Best Practices

Basic Rules

Commit Related Changes

A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits. Small commits make it easier for other developers to understand the changes and roll them back if something went wrong. With tools like the staging area and the ability to stage only parts of a file, Git makes it easy to create very granular commits.

Commit Often

Committing often keeps your commits small and, again, helps you commit only related changes. Moreover, it allows you to share your code more frequently with others. That way it‘s easier for everyone to integrate changes regularly and avoid having merge conflicts. Having large commits and sharing them infrequently, in contrast, makes it hard to solve conflicts.

@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active July 21, 2025 07:57
Conventional Commits Cheatsheet
@jaircuevajunior
jaircuevajunior / mysql_debian_user.md
Last active April 16, 2025 12:35
Fix logrotate error regarding mysql on Ubuntu

Fix logrotate error regarding mysql on Ubuntu

Sometimes if you are mailed of cronjobs, will may got an error like this:

/etc/cron.daily/logrotate:
error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/error.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

Well, don't panic! Also don't ignore it! :)