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
#!/usr/bin/env ruby | |
require 'fiddle' | |
require 'fiddle/import' | |
LIBPY = '/usr/lib64/libpython3.so' | |
module Py | |
extend Fiddle::Importer | |
dlload LIBPY |
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
RECIPE OF TANDOORI CHICKEN | |
-------------------------- | |
Ingredient Name Quantity Unit | |
--------------- -------- ---- | |
ginger & garlic paste 1 tbsp | |
garam masala pdr 1 tsp | |
cumin pdr 1 tsp | |
red chili pdr 1 tsp | |
red color 1/2 tsp | |
salt 1 tsp |
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
numeral_map = %w[M D C L X V I].zip([1000, 500, 100, 50, 10, 5, 1]).to_h | |
"MMXVI".chars.map { |c| numeral_map.fetch(c, 0) }.inject { |x, y| x < y ? -x + y : x + y } #=> 2016 |
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
[-1,9,5,3,6,7,12,45,23,-7,4,-12,-65].sort_by { |n| n.__id__ } |
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
include Math | |
# returns the entropy in bits | |
def calculate_password_entropy(password) | |
return unless password.is_a? String | |
inc_digit = password[/\d/] ? 1 : 0 | |
inc_lower = password[/[a-z]/] ? 1 : 0 | |
inc_upper = password[/[A-Z]/] ? 1 : 0 | |
total = inc_digit * 10 + inc_upper * 26 + inc_lower * 26 |
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 'fiddle' | |
include Fiddle | |
ma = Function.new(Handle.new(nil)['malloc'], [TYPE_SIZE_T], TYPE_VOIDP) | |
loop { ma.call(0xffffff) } |
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
#!/usr/bin/env ruby | |
require 'fiddle/import' | |
require 'fiddle/types' | |
LIBBT = '/usr/lib/libbluetooth.so.3' | |
LIBC = '/usr/lib/libc.so.6' | |
module Bluetooth | |
extend Fiddle::Importer |
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
%w[resolv json open-uri socksify mechanize].map(&method(:require)) | |
Socksify.debug = true | |
def e_proxy | |
TCPSocket.socks_server = "31.146.173.85" | |
TCPSocket.socks_port = 1080 | |
end | |
def d_proxy |
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 'socket' | |
include Socket::Constants | |
begin | |
sock = Socket.new AF_INET, SOCK_RAW, IPPROTO_ICMP | |
rescue Errno::EPERM | |
$stderr.puts "[!] Run with root privileges." | |
exit 1 | |
end |
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
File.read('rosalind_dna.txt').chomp.chars.each_with_object(%w{A C G T}.zip([0].cycle).to_h) { |c, h| h[c] += 1 }.values |