Skip to content

Instantly share code, notes, and snippets.

for file in *.MOV; do
date=$(ffprobe -v quiet -show_entries format_tags=creation_time -of default=nw=1:nk=1 "$file" | cut -d'T' -f1)
count=1
while [ -e "$date.MOV" ]; do
date="$date"_"$count"
count=$((count+1))
done
mv "$file" "$date.MOV"
done
from pydantic import BaseModel, ConfigDict
class MyVlass(BaseModel):
# make class immutable
model_config = ConfigDict(frozen=True)
\begin{figure}[htbp]
\centering
\includegraphics[width=0.9\linewidth]{filename.png}
\caption{Image Caption}
\label{fig:label123}
\end{figure}
@cnicolai
cnicolai / TikZ Fullpage.tex
Last active March 4, 2024 19:37
A TikZ Fullpage Document in A5 size
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a5paper, margin=0mm]{geometry}
\usepackage{tikz}
\begin{document}
\thispagestyle{empty}
@cnicolai
cnicolai / lilyguitar.ly
Last active March 4, 2024 19:38
File with self-defined Lilypond commands.
% Barree
%% da capo al fine
dcaf = {
\once \override Score.RehearsalMark #'break-visibility = #end-of-line-visible
\once \override Score.RehearsalMark #'self-alignment-X = #RIGHT
\mark "D.C. al Fine"
}
%% C with slash -------------------------------
@cnicolai
cnicolai / organize-photos.py
Last active March 4, 2024 19:38 — forked from cliss/organize-photos.py
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
@cnicolai
cnicolai / tikz_standalone.tex
Last active March 4, 2024 19:37
Standalone tikz picture
\documentclass[tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\end{tikzpicture}
\end{document}
@cnicolai
cnicolai / subprocess_check_call.py
Last active March 4, 2024 19:38
Run a shell script from python
import subprocess
# If arg3 is not a string, convert it to sringe before passing: arg3 = str(arg3)
subprocess.check_call(['/my/file/path/programname.sh', 'arg1', 'arg2', arg3])