This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unsigned_leb128_encode_decode import decode_unsigned_leb128, encode_unsigned_leb128 | |
# Python 3.7.4 | |
def encode_signed_leb128(number): | |
# Higher multiple of 7 | |
bits_multiple_of_7 = ((number.bit_length() + 7) // 7) * 7 | |
twos_complement = (1 << bits_multiple_of_7) - number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Max Transactions | Transactions Per Account | Spent Time Min | Spent Time Max | Spent Time Average | Transaction Size Min | Transaction Size Max | Transaction Size Average | |
---|---|---|---|---|---|---|---|---|
1024 | 16 | 2048 | 2048 | 2483 | 15470 | 15470 | 15626 | |
1024 | 32 | 2124 | 2124 | 2348 | 15470 | 15470 | 15600 | |
1024 | 48 | 2070 | 2070 | 2401 | 15470 | 15470 | 15561 | |
1024 | 64 | 2132 | 2132 | 2431 | 15470 | 15470 | 15574 | |
1024 | 80 | 1988 | 1988 | 2366 | 15470 | 15470 | 15587 | |
1024 | 96 | 2054 | 2054 | 2383 | 15470 | 15470 | 15652 | |
1024 | 112 | 2125 | 2125 | 2333 | 15470 | 15470 | 15600 | |
1024 | 128 | 2108 | 2108 | 2302 | 15470 | 15470 | 15483 | |
1024 | 144 | 2036 | 2036 | 2321 | 15470 | 15470 | 15574 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In some cases you need to set the default_url of paper clip base on some condition. e.g. You want to set default image on basis of gender of user. For this purpose this gist can make it possible to use a method as default_url. Just copy paper_clip_default_url_fix.rb to initializers folder, and use default_url as mentioned in model.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/admin/email_previews.rb | |
ActiveAdmin.register_page 'Email Previews' do | |
content do | |
div '.' | |
end | |
sidebar 'Mail Previews' do | |
Dir['app/mailer_previews/*_preview.rb'].each do |preview_path| | |
preview_mailer = File.basename(preview_path, '.rb') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: '2.0' | |
info: | |
description: This is a sample server Petstore server. | |
version: 1.0.0 | |
title: Swagger Petstore | |
host: virtserver.swaggerhub.com | |
basePath: /nazarhussain/Swagger2/1.0.0 | |
schemes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
require 'json' | |
if ARGV.length != 2 | |
puts "Usage: detect_leaks [FIRST.json] [SECOND.json]" | |
exit 1 | |
end | |
first_addrs = Set.new | |
second_addrs = Set.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HTTPParser = process.binding('http_parser').HTTPParser; | |
var parser = require("http").parsers.alloc(); | |
parser.reinitialize(HTTPParser.RESPONSE); | |
parser.onBody = function(body) { | |
console.log(body.toString()); | |
} | |
parser.onIncoming = function(response) { | |
console.log(response.headers); | |
console.log(response.statusCode); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Chmouel Boudjnah <chmouel.boudjnah@rackspace.co.uk> | |
# Not officially supported by Rackspace only as a best effort basis :) | |
# Define yes to make it to copy to url to clipboard (via a shortened url | |
# service) You need to have the software xclip installed in your system. | |
COPY_URL_TO_CLIPBOARD=yes | |
# Containers to ignore in the list | |
CONTAINERS_TO_IGNORE=".CDN_ACCESS_LOGS" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@-webkit-keyframes inprogress{0%{opacity:1}50%{opacity:.1}100%{opacity:1}}@-moz-keyframes inprogress{0%{opacity:1}50%{opacity:.1}100%{opacity:1}}Keyframes inprogress{0%{opacity:1}50%{opacity:.1}100%{opacity:1}}img[src$="blue.png"],img[src$="blue.gif"],img[src$="blue_anime.gif"],img[src$="yellow.png"],img[src$="yellow.gif"],img[src$="yellow_anime.gif"],img[src$="red.png"],img[src$="red.gif"],img[src$="red_anime.gif"],img[src$="grey.png"],img[src$="grey.gif"],img[src$="grey_anime.gif"],img[src$="disabled.png"],img[src$="disabled.gif"],img[src$="disabled_anime.gif"],img[src$="nobuilt.png"],img[src$="nobuilt.gif"],img[src$="nobuilt_anime.gif"],img[src$="aborted.png"],img[src$="aborted.gif"],img[src$="aborted_anime.gif"]{content:url('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');-webkit-border-radius:50%;-moz-border-radius:50%;padding:0;border-radius:50%;background:rgba(0,0,0,.1)}img[src*="blue.png"],img[src*="blue_anime.gif"]{background:#56a556!important}img[src*="yellow.png"],img[s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SimpleForm | |
class FormBuilder | |
def collection_check_boxes_with_hints(attribute, collection, value_method, text_method, options={}, html_options={}) | |
rendered_collection = render_collection( | |
collection, value_method, text_method, options.merge({:item_wrapper_tag => nil}), html_options | |
) do |item, value, text, default_html_options| | |
default_html_options[:multiple] = true | |
builder = instantiate_builder(SimpleForm::ActionViewExtensions::CheckBoxBuilder, attribute, item, value, text, default_html_options) | |
label = builder.label(:class => 'inline checkbox checkbox_with_hints').split("</") | |
[ |
NewerOlder