Skip to content

Instantly share code, notes, and snippets.

View PythonCoderAS's full-sized avatar

PythonCoderAS PythonCoderAS

  • New York City
  • 06:24 (UTC -04:00)
View GitHub Profile
@PythonCoderAS
PythonCoderAS / trim.sh
Created September 19, 2024 17:26
Trim two seconds from the end of every movie file
for file in huge/*.mov
do
duration=`ffprobe -v error -show_entries format=duration -of csv=p=0 $file`
duration=$((duration-2))
ffmpeg -ss 00:00:00 -to $duration -i $file -c copy Final/"$(basename "$file")"
rm "$file"
done
@PythonCoderAS
PythonCoderAS / name.sh
Created September 19, 2024 17:25
Mass rename files exported from Photos.app with created date
for file in huge/*.mov
do
ffprobe -loglevel error -show_entries stream_tags:format_tags -of json $file | jq -r '.format.tags["com.apple.quicktime.creationdate"]' | sed 's/-04:00//g' | sed -E 's/[T:\-]/ /g' | read year month day hour minute second
mv -v $file huge/"Dailies $year-$((month))-$((day)) $((hour))-$((minute))-$((second)).mov"
done
@PythonCoderAS
PythonCoderAS / README.md
Created August 12, 2023 01:16
How to mass resolve a domain list to find valid domains

Input

  • domains: A list of domains without protocol or any slashes. Example: ["google.com", "amazon.com"]
for time in 2019{05..12} {2020..2023}{01..12}; do curl -vL --silent "https://web.archive.org/web/${time}00000000/https://www.imdb.com/pressroom/stats/" > data-$time.txt 2>&1; done
@PythonCoderAS
PythonCoderAS / spawn vs child_process.md
Last active August 5, 2022 23:18 — forked from devarajchidambaram/spawn vs child_process
Difference between spawn and exec functions of child_process

Difference between spawn and exec functions of child_process

The Node.js Child Processes module (child_process) has two functions spawn and exec, using which we can start a child process to execute other programs on the system. Those new to child_process may wonder why there are two functions to do the same thing, and which one they should use. I'll explain the differences between spawn and exec to help you decide when to use what.

The most significant difference between child_process.spawn and child_process.exec is in what they return - spawn returns a stream and exec returns a buffer.

child_process.spawn returns an object with stdout and stderr streams. You can tap on the stdout stream to read data that the child process sends back to Node. stdout being a stream has the "data", "end", and other events that streams have. spawn is best used to when you want the child process to return a large amount of data to Node - image processing, reading binary data etc.

child_process.spawn is "asynchronously async

pipenv run pip install --verbose --upgrade --force xonsh
Using pip 22.0.4 from /Users/User/.local/share/virtualenvs/xonsh-0.12.5-m1tMou8K/lib/python3.9/site-packages/pip (python 3.9)
Collecting xonsh
Using cached xonsh-0.12.5-py39-none-any.whl (891 kB)
Installing collected packages: xonsh
Attempting uninstall: xonsh
Found existing installation: xonsh 0.12.5
Uninstalling xonsh-0.12.5:
Removing file or directory /Users/User/.local/share/virtualenvs/xonsh-0.12.5-m1tMou8K/bin/xonsh
Removing file or directory /Users/User/.local/share/virtualenvs/xonsh-0.12.5-m1tMou8K/bin/xonsh-cat
#!/usr/bin/env python3
# Note: Do not embed any non-ASCII characters in this file until pip has been
# fixed. See https://github.com/xonsh/xonsh/issues/487.
import os
import subprocess
import sys
from setuptools import setup
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
HOMEBREW_VERSION: 3.5.2-102-g65e077a
ORIGIN: https://github.com/Homebrew/brew
HEAD: 65e077aac9aaf616a8394f74e4f41be24cb344e0
Last commit: 31 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 02117d348272bad00e9f13cb380a86c456be9c3d
Core tap last commit: 13 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: Unknown support status
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
brew livecheck --cask clix --debug
Cask: clix
Livecheckable?: Yes
URL (url): https://rixstep.com/4/0/clix//clix.zip
Strategy: ExtractPlist
==> Extracting primary container
/usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/3.5.2-102-g65e077a\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 11.4\)\ curl/7.64.1 --header Accept-Language:\ en --retry 3 --location --silent --head --request GET https://rixstep.com/4/0/clix//clix.zip
==> Checking quarantine support