This file contains hidden or 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 logging | |
logger = logging.getLogger("MyFileLogger") | |
log_path = os.path.join(os.getcwd(), "my_log.txt") | |
file_handler = logging.FileHandler(log_path) | |
formatter = logging.Formatter( |
This file contains hidden or 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 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] |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
# 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 |