Skip to content

Instantly share code, notes, and snippets.

View dx7's full-sized avatar

Rafael Carvalho dx7

View GitHub Profile
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
[
{
"target": "timeShift(player_data.vod.player._metrics.audience, -10min)",
"datapoints": [
[
83739,
1532055000
]
]
}
@dx7
dx7 / tinyproxy.rb
Last active August 29, 2015 14:07
Tinyproxy: Formula to install from HEAD
require 'formula'
class Tinyproxy < Formula
homepage "https://www.banu.com/tinyproxy/"
url "https://www.banu.com/pub/tinyproxy/1.8/tinyproxy-1.8.3.tar.bz2"
sha1 "2538fbd190d3dc357a2e7c2a07ea0fbefb768a13"
head do
url "https://github.com/dx7/tinyproxy.git", :branch => "1.8"
depends_on "autoconf" => :build
@dx7
dx7 / Gemfile
Last active August 29, 2015 14:06 — forked from hubertlepicki/Gemfile
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 4.0"
gem "railties", "~> 4.0"
gem "tzinfo"
# Let's use thin
require 'formula'
class MediaInfo < Formula
homepage 'http://mediainfo.sourceforge.net'
url 'http://mediaarea.net/download/binary/mediainfo/0.7.67/MediaInfo_CLI_0.7.67_GNU_FromSource.tar.bz2'
version '0.7.67'
# sha1 'e5bfc3af8d3a0995785f1963c78ff9a6505e9626'
sha1 'e4b939c7d04ba52be679bcfd577905b65f6c72c6'
head 'svn://svn.code.sf.net/p/mediainfo/code'
@dx7
dx7 / gist:9424562
Created March 8, 2014 02:49
Ternário do stdio.h
/*
* This has been tuned to generate reasonable code on the vax using pcc.
*/
#define __sputc(c, p) \
(--(p)->_w < 0 ? \
(p)->_w >= (p)->_lbfsize ? \
(*(p)->_p = (c)), *(p)->_p != '\n' ? \
(int)*(p)->_p++ : \
__swbuf('\n', p) : \
__swbuf((int)(c), p) : \

Keybase proof

I hereby claim:

  • I am dx7 on github.
  • I am dx7 (https://keybase.io/dx7) on keybase.
  • I have a public key whose fingerprint is 35FE C788 27E0 0669 564A 6228 85FE F453 4D62 6DC2

To claim this, I am signing this object: