Skip to content

Instantly share code, notes, and snippets.

View dx7's full-sized avatar

Rafael Carvalho dx7

View GitHub Profile
puts "Hello from Gist"
module Base16
def self.strict_encode16(s)
s.unpack1('H*')
end
def self.strict_decode16(s)
[s].pack('H*')
end
end
@dx7
dx7 / base16.rb
Created May 13, 2021 21:49 — forked from sspreitzer/base16.rb
ruby base16
# Ruby base16 encode/decode
# (c) Sascha Spreitzer, 2016
# MIT license
def b16decode(what)
chars = ''
ret = ''
what.each_char do |c|
chars += c
if chars.size == 2
#!/usr/bin/env bash
set -e
addEntries() {
# check if universal access / custom menu key exists
if defaults read com.apple.universalaccess com.apple.custommenu.apps > /dev/null 2>&1; then
defaults delete com.apple.universalaccess com.apple.custommenu.apps
fi
@dx7
dx7 / ruby_data_object_comparison.rb
Created April 15, 2020 18:47 — forked from palexander/ruby_data_object_comparison.rb
Benchmark to compare hash, OpenStruct, struct, and classes in Ruby
require 'ostruct'
require 'benchmark'
COUNT = 10_000_000
NAME = "Test Name"
EMAIL = "test@example.org"
class Person
attr_accessor :name, :email
end
@dx7
dx7 / gist:1333785
Created November 2, 2011 14:33
Installing ruby-debug with ruby-1.9.3-p0
### UPDATE: ruby-debuy19 is no longer maintained, use https://github.com/cldwalker/debugger
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
[
{
"target": "timeShift(player_data.vod.player._metrics.audience, -10min)",
"datapoints": [
[
83739,
1532055000
]
]
}
require 'formula'
class Ffmpeg < Formula
homepage 'http://ffmpeg.org/'
url 'http://ffmpeg.org/releases/ffmpeg-2.0.1.tar.bz2'
sha1 'cc36c696228221ce14585edd90fb6413d206a5c8'
head 'git://git.videolan.org/ffmpeg.git'
option "without-x264", "Disable H.264 encoder"
@dx7
dx7 / gist:5623348
Created May 21, 2013 21:20
Smooth Streaming manifest generated by USP from edited ISM with just one audio track. It works fine.
<?xml version="1.0" encoding="utf-8"?>
<!--Created with Unified Streaming Platform(version=1.4.57)-->
<SmoothStreamingMedia
MajorVersion="2"
MinorVersion="0"
TimeScale="10000000"
Duration="3022933333">
<StreamIndex
Type="audio"
QualityLevels="1"
@dx7
dx7 / gist:5623339
Created May 21, 2013 21:19
ISM file edited. It has just one audio track.
<?xml version="1.0" encoding="utf-8"?>
<!--Created with Unified Streaming Platform(version=1.4.57)-->
<smil xmlns="http://www.w3.org/2001/SMIL20/Language">
<head>
<meta name="clientManifestRelativePath" content="10004284.ismc" />
<meta name="creator" content="Unified Streaming Platform (USP)" />
<meta name="lookahead_fragments" content="2" />
<meta name="dvr_window_length" content="30" />
<meta name="archive_segment_length" content="0" />
<meta name="archiving" content="false" />