This file contains hidden or 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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <math.h> | |
/** | |
* Auto-generated code below aims at helping you parse | |
* the standard input according to the problem statement. | |
**/ | |
This file contains hidden or 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
def hex_to_base32(hex) | |
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','2','3','4','5','6','7'] | |
bin_array = hex.split('').each_slice(2).map(&:join).map { |el| el.to_i(16) }.map do |el| | |
str = el.to_s(2) | |
prefix_length = 8 - str.length | |
"#{'0' * prefix_length}#{str}" | |
end | |
bin_array.join.split('').each_slice(5).map(&:join).map { |el| alphabet[el.to_i(2)] }.join |
This file contains hidden or 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
IPAddr.new('10.0.0.0/8').to_range.each_slice(256).map(&:first).map { |ip| ip.mask(8 * (4 - ip.to_s.split('.').reverse.take_while(&'0'.method(:==)).count)) } |
This file contains hidden or 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
/* | |
* Copyright (c) 1998-2013 Proofpoint, Inc. and its suppliers. | |
* All rights reserved. | |
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. | |
* Copyright (c) 1988, 1993 | |
* The Regents of the University of California. All rights reserved. | |
* | |
* By using this file, you agree to the terms and conditions set | |
* forth in the LICENSE file which can be found at the top level of | |
* the sendmail distribution. |
This file contains hidden or 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
(defn fib-1 [n] | |
(if (< n 3) | |
1 | |
(+ (fib-1 (- n 1)) | |
(fib-1 (- n 2))))) | |
(defn fib-2 [n] | |
(let [ lazy-fib ((fn lazy-gen [n1 n2] | |
(cons (+ n1 n2) | |
(lazy-seq |
This file contains hidden or 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
namespace :'mail.ru' do | |
namespace :user do | |
# | |
# Usage: | |
# $rake mail.ru:user:disable USERNAME=p.chechetin or $rake mail.ru:user:disable [email protected] | |
# | |
# Exit code: | |
# 0 => Success | |
# 1 => Failure | |
# |
This file contains hidden or 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 'yaml' | |
module Puppet::Parser::Functions | |
newfunction(:generate_role, :type => :rvalue) do |args| | |
fact = args[0] | |
path = args[1] | |
default = args[2] | |
This file contains hidden or 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
82c82 | |
< CONFIG["LIBRUBY_DLDFLAGS"] = "-undefineddynamic_lookup -multiply_definedsuppress -install_name $(libdir)/$(LIBRUBY_SO) -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(ruby_version) $(XLDFLAGS)" | |
--- | |
> CONFIG["LIBRUBY_DLDFLAGS"] = "-undefineddynamic_lookup -multiply_defined suppress -install_name $(libdir)/$(LIBRUBY_SO) -current_version $(MAJOR).$(MINOR).$(TEENY) -compatibility_version $(ruby_version) $(XLDFLAGS)" | |
125c125 | |
< CONFIG["DLDFLAGS"] = "-undefineddynamic_lookup -multiply_definedsuppress" | |
--- | |
> CONFIG["DLDFLAGS"] = "-undefineddynamic_lookup -multiply_defined suppress" |
This file contains hidden or 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
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include |
This file contains hidden or 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
Bundler::LockfileParser.new(IO.read('./Gemfile.lock')) |