Skip to content

Instantly share code, notes, and snippets.

View cobanov's full-sized avatar
🦊
Focusing

Mert Cobanov cobanov

🦊
Focusing
View GitHub Profile
import os
import logging
logger = logging.getLogger("MyFileLogger")
log_path = os.path.join(os.getcwd(), "my_log.txt")
file_handler = logging.FileHandler(log_path)
formatter = logging.Formatter(
import pandas as pd
import string
import sys
INPUT_FILE = sys.argv[1]
OUTPUT_FILE = sys.argv[2]
bad_words = string.punctuation + string.digits
bad_list = [i for i in bad_words]
# Find files with extension
find . -type f -name "*.mp4"
file: -f directory: -d
# Show file sizes
ls -lh
# Count how many files in folder
ls -l | wc -l
# MP3 to WAV
ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "wav-exports/${f%.}.wav"
# MP4 to PNG
ffmpeg -i test.mp4 -vf fps=1/2 png-exports/video13_%06d.png
# Basic Example
awk -F: '{print $1, $NF}' /etc/passwd
-F:|Colon as a separator
{...}|Awk program
print|Prints the current record
$1|First field
$NF|Last field
/etc/passwd|Input data file
# Variables
# SCP
scp <options> source_path destination_path
scp file user@host:/path/to/file|# copying a file to the remote system using scp command
scp user@host:/path/to/file /local/path/to/file|# copying a file from the remote system using scp command
scp file1 file2 user@host:/path/to/directory|# copying multiple files using scp command
scp -r /path/to/directory user@host:/path/to/directory|# Copying an entire directory with scp command
# Options
-r|transfer directory
-v|see the transfer details
# Refik Anadol Studio - 2022
import re
import spacy
import pandas as pd
import multiprocessing
from collections import defaultdict
from gensim.models import Word2Vec
from gensim.models.phrases import Phrases, Phraser
# Environment
conda create --name env_name python=3.x|Create a new environment named env_name, install Python 3.x
conda activate env_name|Activate the new environment to use it
conda deactivate|Deactivate the environment
conda env list|Get a list of all my environments, active environment is shown with *
conda env export > puppies.yml|Save current environment to a file
# Packages
conda install PACKAGENAME|Install a package included in Anaconda
conda remove beautiful-soup
@cobanov
cobanov / docker.txt
Last active February 27, 2022 10:12
docker pull image_namem|Download an image, and all its parents, from the registry.
docker run -ti --name container_name image_name /command|Run a shell command inside a freshly created and started container.
docker start container_name|Start a container
docker stop container_name|Stop a container
docker kill $(docker ps -q)|Kill all running docker containers
docker build image_name .|Build an image
docker image ls|List all images
docker ps|Manage containers using ps/kill
# Create a new repository on the command line
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/cobanov/test.git
git push -u origin main
# Push an existing repository from the command line