Skip to content

Instantly share code, notes, and snippets.

View costa's full-sized avatar

Costa Shapiro costa

View GitHub Profile
|o|
# NOTE Run me like this: | <ffmprb> <OUT-PATH>
# NOTE A bit of a boilerplate for more independence:
# NOTE for previewing
# video_output_options = {resolution: Ffmprb::HD_720p, fps: 30, encoder: 'libx264'}
# NOTE for further processing:
video_output_options = {resolution: Ffmprb::HD_4K, fps: 60, encoder: 'huffyuv'}
# NOTE for viewing
@costa
costa / stackshare-2y-old-listing-review.pub-1.ffmp.rb
Created May 24, 2023 09:39
A FFmpRb script for the DEMO of the solo screen-based-presentation format
|o|
# NOTE Run me like this: | <ffmprb> <OUT-PATH>
# NOTE A bit of a boilerplate for more independence:
video_output_options = {resolution: Ffmprb::HD_4K, fps: 30, encoder: 'libx264'}
Ffmprb::Process.input_video_auto_rotate = true # NOTE surprisingly, for the sake of oiPad media...'
class FfmprbUnzipper
def initialize
@tmp_files = []
@costa
costa / stackshare-2y-old-listing-review.pub-2.ffmp.rb
Last active May 24, 2023 09:39
A FFmpRb script for the DEMO of the solo screen-based-presentation format
|o|
# NOTE Run me like this: | <ffmprb> <OUT-PATH>
# NOTE A bit of a boilerplate for more independence:
# NOTE for further processing:
video_output_options = {resolution: Ffmprb::HD_4K, fps: 60, encoder: 'huffyuv'}
Ffmprb::Process.input_video_auto_rotate = true # NOTE surprisingly, for the sake of oiPad media...'
@costa
costa / docker-compose.yml
Created March 22, 2023 04:38
simple torrenting "comp" with a web interface
version: '2.1'
services: # NOTE basic, no VPN, setup
torrenting:
image: linuxserver/transmission
environment:
- PORT=9091 # NOTE needed by the (self server) platform
- PEERPORT=31415 # NOTE a random port for torrent proto
- PGID=0 # NOTE the (self server) platform has...
- PUID=0 # ...limited use for permissions
- TZ=Etc/UTC
@costa
costa / ffmpeg-filtergraph-script
Created March 10, 2023 13:36
a large ffmpeg filtergraph causes abysmal performance
[6:v] scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih), setsar=1, pad=1280:720:(1280-iw*min(1280/iw\,720/ih))/2:(720-ih*min(1280/iw\,720/ih))/2, setsar=1, fps=fps=60 [tmo0rl0:v]; [6:a] anull [tmo0rl0:a]; color=0x000000@0:d=7.0:s=1280x720:r=60 [blo0rl0:v]; [tmo0rl0:v] [blo0rl0:v] concat=2:v=1:a=0 [pdo0rl0:v]; [pdo0rl0:v] trim=11.0:18.0, setpts=PTS-STARTPTS [o0rl0:v]; aevalsrc=0:d=7.0 [blo0rl0:a]; [tmo0rl0:a] [blo0rl0:a] concat=2:v=0:a=1 [pdo0rl0:a]; [pdo0rl0:a] atrim=11.0:18.0, asetpts=PTS-STARTPTS [o0rl0:a]; [0:v] scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih), setsar=1, pad=1280:720:(1280-iw*min(1280/iw\,720/ih))/2:(720-ih*min(1280/iw\,720/ih))/2, setsar=1, fps=fps=60 [tmo0rl1:v]; [0:a] anull [tmo0rl1:a]; color=0x000000@0:d=8:s=1280x720:r=60 [blo0rl1:v]; [tmo0rl1:v] [blo0rl1:v] concat=2:v=1:a=0 [pdo0rl1:v]; [pdo0rl1:v] trim=7:15, setpts=PTS-STARTPTS [o0rl1:v]; aevalsrc=0:d=8 [blo0rl1:a]; [tmo0rl1:a] [blo0rl1:a] concat=2:v=0:a=1 [pdo0rl1:a]; [pdo0rl1:a] atrim=7:15, asetpts=PTS-STARTPTS [o0rl1:a];
$ DU_IGNORES=Volumes ~/local/script/du_sum.rb
du -I 'Volumes' /
Password:
1550280 du
.20T /Users
...
| 25.G /Users/Shared
| | | 24.G /Users/Shared/iTunes/Music
...
38.G /Applications
@costa
costa / PUB.md
Last active August 20, 2024 08:34
basic hierarchical file system analysis script

The most ancient problem of disk space -- and an also ancient problem of sharing scripts

Please disregard this public post if

  • you think that you have not had any disk space problems in recent years and that the author quite frankly might just be behind on personal computing technology since everything is done "off the cloud" these days, or --
  • you think the problem is too advanced for you to even try anything (like simply analysing your file system hierarchically, on your own) and you trust that "common" (commercial) solutions are your best options -- whenever it happens
@costa
costa / wicked_pdf.rb
Created October 1, 2021 19:20
Workaround setup for: https://github.com/mileszs/wicked_pdf/issues/860 (see my comment there)
# ./config/initializers/wicked_pdf.rb
WICKED_PDF_HELPER_SERVER_PORT = 28601 # NOTE no reason
WickedPdf.config = {
# Layout file to be used for all PDFs
# (but can be overridden in `render :pdf` calls)
# layout: 'pdf.html',
}.tap do |config|
rack_up = caller.map(&:to_s).grep(/rack.*server/i).any? # SEE https://stackoverflow.com/a/49598328/714287
if rack_up && Rails.configuration.asset_host.blank?
@costa
costa / nginx-conf.d-default.conf
Last active August 10, 2021 13:00
Sample (nginx) reverse proxy configuration for Docker Compose configuration for "staging" web interface access with OpenVPN
server {
listen 80;
listen [::]:80;
location / {
proxy_pass https://some.internal-web.app;
}
}
@costa
costa / docker-compose.yml
Created August 10, 2021 12:57
Sample Docker Compose configuration for "staging" web interface access with OpenVPN
version: '3.4'
services:
open-vpn:
image: dperson/openvpn-client
cap_add:
- net_admin
devices:
- /dev/net/tun
dns: 8.8.4.4 # NOTE not sure how to make this generic
command: -d -a "$OVPN_USER;$OVPN_OTP"