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
#!/usr/bin/env python3 | |
import os | |
import requests | |
import json | |
import tenacity | |
# GLOBAL API URL / HEADER | |
CUSTOM_API = os.environ['CUSTOM_API'] | |
DATA_API = os.environ['DATA_API'] |
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
Recreate a folder: | |
folder = /path/N_123456_01of05 | |
root = /path/N_123456_01of03/scan01/2048x1560 | |
dpx_path = /path/N_123456_01of03 | |
This command returns: | |
new_folder = os.path.join(folder2, os.path.relpath(root, dpx_path)) | |
new_folder = /path/N_123456_01of05/scan01/2048x1560 | |
os.path.relpath() returns the remainder of the first argument when the second is removed. |
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
Git terminal shortcuts for Linux | |
[Part borrowed from cferdinandi - https://gist.github.com/cferdinandi/ef665330286fd5d7127d] | |
### Most used | |
cd into server repository you want to update | |
git init | |
git remote add upstream <upstream github url> # Add original as upstream | |
git merge upstream/main # Replaces local server version with GitHub repository | |
git log # Update of recent changes |
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
# Switch between bash / zsh in Terminal: | |
chsh -s /bin/bash | |
Search in files for a string match, case ignored | |
grep -iRI "String to match" | |
nano <scriptname>.sh (or launch with nano, and ctrl + s to save later) | |
GNU nano, emulates a text editor and allows editing/writing of bash scripts. | |
Shortcuts: | |
ctrl + k - cut text |
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
watch -n 4 'date ; echo ; free' | |
Monitoring memory on a Linux system | |
sudo apt install ubuntu-desktop-minimal | |
Install Ubuntu GNOME Desktop Minimal (ubuntu-desktop-minimal package) | |
Ubuntu GNOME Desktop Minimal is a flavor of Ubuntu GNOME that is smaller and | |
lighter than the full Ubuntu GNOME Desktop. It uses a slimmed-down software selection. | |
The purpose of this flavor is to provide a smaller, lighter system to those users | |
who have older hardware or who want a more minimal system. | |
On a fresh Ubuntu server install, it will take about ~800MB space. |
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
IN NO PARTICULAR ORDER, YET. | |
sudo reboot | |
Useful if your workstation hangs, as long as you can access a terminal. | |
gnome-session-quit | |
Log out of the workstation | |
gnome-screenshot -a | |
Drag/drop screenshot area (linux) |
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
Appendix N. Converting DOS Batch Files to Shell Scripts | |
Credit the Linux Documentation Project - https://www.tldp.org/LDP/abs/html/dosbatch.html | |
Quite a number of programmers learned scripting on a PC running DOS. Even the crippled DOS batch file language allowed writing some fairly powerful scripts and applications, though they often required extensive kludges and workarounds. Occasionally, the need still arises to convert an old DOS batch file to a UNIX shell script. This is generally not difficult, as DOS batch file operators are only a limited subset of the equivalent shell scripting ones. | |
Table N-1. Batch file keywords / variables / operators, and their shell equivalents | |
Batch File Operator / Shell Script Equivalent / Meaning | |
% $ command-line parameter prefix | |
/ - command option flag |
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
MACE SPECIFIC CLI SHORTCUTS | |
FFMPEG CONVERSIONS | |
1. SD 4:3 MOV to H264 MOV (gop 1 intraframe): | |
ffmpeg -i input.mov -c:v libx264 -pix_fmt yuv420p -flags +ildct -map 0 -aspect 4:3 -g 1 -crf 14 -c:a copy -metadata "copyright=Copyright © 2019 Media Archive for Central England" -metadata "comment=To license this item please contact MACE on 01522 837750 or visit www.macearchive.org" output.mov | |
2. SD 16:9 MOV to H264 MOV (gop 1 intraframe): |
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
# Coded by James Wingate, Katherine Frances Nagels and Joanna White | |
from ffprobe3 import FFProbe | |
import os | |
import re | |
import subprocess | |
import sys | |
# The keys are the shortform name for each resolution, | |
# corresponding to the expected .png watermark file. |
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
C:\Users\MACE Digital Tech>mediainfo --Details=1 "T:\COMPLETED\DPX BEING PACKAGED\Scan01\25462_01_000000.dpx" | |
000000000 ------------------------- | |
000000000 --- DPX, accepted --- | |
000000000 ------------------------- | |
000000000 Generic section header (1664 bytes) | |
000000000 File information (768 bytes) | |
000000000 Magic number: XPDS | |
000000004 Offset to image data: 8192 (0x00002000) | |
000000008 Version number of header format: V2.0 | |
000000010 Total image file size: 12402688 (0x00BD4000) |
NewerOlder