Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Cline briancline

  • SoftLayer / IBM Cloud
  • Dallas, Texas
View GitHub Profile
@briancline
briancline / 0readme.md
Last active February 2, 2023 22:10
patch for ffmpeg 5.1: allow use of `%t` in image2 output filenames to include video timestamp of the frame
View 0readme.md

ffmpeg patch: video timestamp in image2 output filenames (2022-10-27)

What it do

When extracting individual frames from a video file as image outputs, allows the use of %t in the output filename to be substituted at runtime with the timecode for each frame (for example 00.01.02.033).

Therefore an output filename of wtf_%t.jpg looks like wtf_00.11.22.333.jpg.

@briancline
briancline / 0-pvemanagerlib-fix-sorting.diff
Created December 8, 2021 01:46
Proxmox VE - Fix strange ID-based sorting to sort by VM/container names instead
View 0-pvemanagerlib-fix-sorting.diff
--- /usr/share/pve-manager/js/pvemanagerlib.js 2021-11-24 11:32:51.000000000 -0600
+++ /usr/share/pve-manager/js/bc-pvemanagerlib.js 2021-11-29 15:44:54.070286236 -0600
@@ -3785,7 +3785,7 @@
if (Ext.isNumeric(info.vmid) && info.vmid > 0) {
text = String(info.vmid);
if (info.name) {
- text += " (" + info.name + ')';
+ text = info.name + ' (' + text + ')';
}
} else { // node, pool, storage
@briancline
briancline / postgres_queries_and_commands.sql
Created December 10, 2022 06:33 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@briancline
briancline / mock_datetime.py
Created November 25, 2022 08:31 — forked from rbarrois/mock_datetime.py
Proper module for patching datetime.datetime.now().
View mock_datetime.py
# This code is in the public domain
# Author: Raphaël Barrois
from __future__ import print_function
import datetime
import mock
@briancline
briancline / reasonable-corners.js
Last active October 29, 2022 07:05
Everyone please calm down with the gigantic fisher-price rounded corners on everything (especially you, Google)
View reasonable-corners.js
_chill_factor = 0.25;
_chill_threshold = 5; // px
for (const el of document.querySelectorAll('*')) {
for (const _corner of ['TopLeft', 'TopRight', 'BottomRight', 'BottomLeft']) {
_prop = 'border' + _corner + 'Radius';
if (window.getComputedStyle(el)[_prop] !== '0px') {
_rad = parseInt(window.getComputedStyle(el)[_prop]);
if (isNaN(_rad) || _rad <= _chill_threshold) {
continue;
@briancline
briancline / .pylintrc
Created June 6, 2022 17:51
Example pylintrc (mostly based off a few OpenStack projects' pylintrcs)
View .pylintrc
[MASTER]
ignore=CVS,.git,.venv,.env,.env3,.tox,dist,doc,*egg,alembic
extension-pkg-whitelist=alembic
[TYPECHECK]
# generated-members=SymbolName
[MESSAGES CONTROL]
# C0111: Missing module docstring
# C0301: Line too long (pycodestyle checks this)
@briancline
briancline / swift-ecdeps-osx.sh
Last active December 8, 2021 02:03
Install Swift/PyECLib dependencies on OSX
View swift-ecdeps-osx.sh
#!/bin/bash
## swift-ecdeps-osx.sh
## https://gist.github.com/briancline/364d539e0e230b92adae
##
## This script is meant to be used on OSX as a quick and easy way to download,
## build, and install gf-complete, Jerasure, and liberasurecode to any prefix
## path you specify. These are typically what you may want if you're working
## with OpenStack Swift for a quick and dirty EC-friendly test run.
##
## The Xcode command line tools are required in order for this to work.
@briancline
briancline / app.py
Created March 24, 2021 21:47
Fix for nginx + flask
View app.py
from werkzeug.middleware import proxy_fix
app = flask.Flask('thing')
app.wsgi_app = proxy_fix.ProxyFix(app.wsgi_app, x_proto=1, x_host=1)
@briancline
briancline / ceph-grow-rbd-xfs
Last active September 16, 2020 13:42
Growing a Ceph RBD volume and an XFS filesystem contained within
View ceph-grow-rbd-xfs
# df -h /dev/rbd0
Filesystem Size Used Avail Use% Mounted on
/dev/rbd0 1.5T 1.5T 557M 100% /mnt/media
# rbd info media/media01
rbd image 'media01':
size 1536 GB in 393216 objects
order 22 (4096 kB objects)
block_name_prefix: rb.0.1098.74b0dc51
format: 1