Skip to content

Instantly share code, notes, and snippets.

View os6sense's full-sized avatar

Adrian Lee os6sense

  • MyMedsAndMe
  • London, UK
View GitHub Profile
@os6sense
os6sense / gist:b9720881b2172c07eb88fea6cad006cf
Created November 22, 2021 00:22
http-echo with working microk8s ingress example
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/name: http-echo
run: http-echo
app: http-echo
name: http-echo
spec:
@os6sense
os6sense / gist:2673f7997cdbb1c8e97040257d746ea6
Created October 23, 2021 09:07
Tilt, docker build, and ssh-agent forwarding
This took a while to figure out because the information is a bit spreadout and I was missing a piece of the puzzle.
SSH agent forwarding:
Set up ssh-agent for github and ensure your local key works
(see https://docs.github.com/en/developers/overview/using-ssh-agent-forwarding)
Tiltfile
Add ssh="default" as a parameter to the docker_build which which needs to pull from github
docker_build( 'localhost:32000/something', '../something',
require 'find'
""" asciidoc
Class: Directory Treee
Recurse down a directory tree
"""
module EAsciidoc
class DirectoryTree
def initialize(directories)
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@os6sense
os6sense / gist:35b9e37eb8f23bdb4a81cde1cc23aa03
Created May 12, 2017 13:26
Using memory_profiler with rails
add to gemfile :
gem 'memory_profiler', require: true, github: 'SamSaffron/memory_profiler'
Add a config/initializer/memory_profiler.rb as follows:
MemoryProfiler.start
at_exit do
report = MemoryProfiler.stop
report.pretty_print
@os6sense
os6sense / gist:db80d6970db6091f9089
Created February 13, 2015 13:46
__using__ using use
# used from within a test (e.g. use UseDI.A) the following is output:
# __using__ UseDI. caller : Elixir.UseDependencyInjectionTest
# __using__ UseDI.A. caller : Elixir.UseDependencyInjectionTest
import IO, only: [puts: 1]
defmodule UseDI do
defmacro __using__(_) do
quote do
@os6sense
os6sense / gist:4d71a2e887e81050cc91
Last active August 29, 2015 14:14
(sort of dynamic) alias as a macro in Elixir
# dynamic_alias.ex
defmodule DynamicAlias do
@doc
"""
The following macro will introduce an alias into the calling module replacing
the last part of the module name with the contents of List.replace_at/3.
This is useful if you want to automatically references a different module
without knowing the fully qualified module name, but I'm new to Elixir and
there may be a better way to do this.
@os6sense
os6sense / gist:c275bc89a6fd969835e2
Created May 12, 2014 19:07
bmdcapture and ffmpeg muxing audio from seperate source to ffserver
sudo bmdcapture -m 2 -A 0 -C 0 -V 1 -F nut -f pipe:1 | sudo ffmpeg -f alsa -i plughw:UA25 -i - -f ffm http://localhost:8090/feed1.ffm
Order of everything is VITAL otherwise the muxed audio ends up being ignored. 3 hours time wasted messing with map :/
@os6sense
os6sense / gist:8157eaa820a3abb211dc
Last active August 29, 2015 14:00
Black Magic DSK direct link
SDK
http://software.blackmagicdesign.com/SDK/Blackmagic_DeckLink_SDK_10.1.zip
Drivers
http://software.blackmagicdesign.com/DesktopVideo/Blackmagic_Desktop_Video_Linux_10.1.tar.gz
require 'benchmark'
Benchmark.bm(20) do |x|
x.report ('<<') do
out = ""
100_000.times do
one = 'one'
two = 'two'
three = 'three'
out << "#{one}" << "#{two}" << "#{three}"