Skip to content

Instantly share code, notes, and snippets.

View sax's full-sized avatar

Eric Saxby sax

View GitHub Profile
@sax
sax / .SWIFT_BRIDGE_WARNING
Last active May 2, 2024 01:16
swift-bridge nightly warning
We couldn’t find that file to show.
@sax
sax / _table
Last active October 18, 2021 22:11
eprof membrane core analysis
Process: #PID<0.3196.0>, Struct: Elixir.Membrane.Core.Pipeline.State, Module: Elixir.Membrane.RTC.Engine
Process: #PID<0.3197.0>, Clock
Process: #PID<0.3199.0>, Clock
Process: #PID<0.3201.0>, Clock
Process: #PID<0.3208.0>, Clock
Process: #PID<0.3234.0>, Clock
Process: #PID<0.3243.0>, Clock
Process: #PID<0.3776.0>, Clock
Process: #PID<0.3778.0>, Clock
Process: #PID<0.3785.0>, Clock
@sax
sax / 1-crash
Last active October 7, 2021 16:15
membrane re-linking crash
[error] GenServer #PID<0.1474.0> terminating
** (Membrane.LinkError) Pad {Membrane.Pad, :input, "80942349-2d9d-48f2-b20e-f5d1aabbb057:c8beb6b4-5c3c-4c8f-8521-43c32490e172 "} has already been linked
(membrane_core 0.7.0) lib/membrane/core/child/pad_controller.ex:165: Membrane.Core.Child.PadController.validate_pad_being_linked!/4
(membrane_core 0.7.0) lib/membrane/core/child/pad_controller.ex:48: Membrane.Core.Child.PadController.handle_link/5
(membrane_core 0.7.0) lib/membrane/core/bin.ex:173: Membrane.Core.Bin.handle_call/3
(stdlib 3.16) gen_server.erl:721: :gen_server.try_handle_call/4
(stdlib 3.16) gen_server.erl:750: :gen_server.handle_msg/6
(stdlib 3.16) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.1587.0>): {Membrane.Core.Message, :handle_link, [:input, %Membrane.Core.Parent.Link.Endpoint{child: {:endpoint, "0c920133-55a6-45a3-9087-9ef9307d906a"}, pad_props: [options: [encoding: :OPUS]], pad_ref: {Membrane.Pad, :input, "80942349-2d9d-48f2-b20e-f5d1aabbb0
@sax
sax / config.exs
Last active July 7, 2024 16:21
Elixir OpenTelemetry LiveView / crash tracking
import Config
## ....
config :logger,
backends: [
:console,
OpenTelemetryCrashLogger
]
### Keybase proof
I hereby claim:
* I am sax on github.
* I am s4xx4s (https://keybase.io/s4xx4s) on keybase.
* I have a public key ASDd9tKJczNf1S-dwRLmjMh0tsoGL4gDBTaMaL9fqzSF2Ao
To claim this, I am signing this object:
@sax
sax / content_type_detector.rb
Created August 10, 2017 18:01
paperclip content-type detection for Office
module Paperclip
module ContentTypeDetectorOverrides
def calculated_type_matches
possible_types.select do |content_type|
if content_type.start_with?('application/vnd.openxmlformats-officedocument')
content_type == type_from_file_contents ||
type_from_file_contents == 'application/zip'
else
content_type == type_from_file_contents
end
@sax
sax / __scenario_flows.rb
Last active July 18, 2017 19:14
Flow output in feature specs
# lib/test/scenario_flows.rb
module Test
module ScenarioFlows
def formatter
@formatter ||= RSpec.configuration.formatters.first
end
def formatter_names
@formatter_names ||= RSpec.configuration.formatters.map { |f| f.class.to_s }.join(' ')
@sax
sax / ffmpeg -- logo overlay
Last active May 21, 2017 22:52
ffmpeg: add overlay to video
ffmpeg -i video.mp4 -vf \
"movie=logo.png [overlay]; \
[overlay] scale=250:-1 [a]; \
[a] format=yuva420p,colorchannelmixer=aa=0.5 [b]; \
[in] curves=preset=lighter [vid]; \
[vid][b] overlay=50:50 [out]" \
-pix_fmt yuv420p \
output.mp4 \
&& terminal-notifier -message 'done'
@sax
sax / consumer.rb
Created April 26, 2016 00:38
Example sidekiq worker
class Worker
include Sidekiq::Worker
def perform(message)
puts message
end
end
@sax
sax / load_data.sh
Last active February 16, 2017 11:18
Dump and reload data into PostgreSQL with massive concurrency
# interpolated load tables step
find . -type f -print0 | xargs -0 -n1 -P50 bash -c "psql -U <postgres_user> <mydatabase> < \$0"