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
package it.telecomitalia.IMSIPlugin; | |
import org.json.JSONArray; | |
import android.content.Context; | |
import android.telephony.TelephonyManager; | |
import com.phonegap.api.Plugin; | |
import com.phonegap.api.PluginResult; |
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
diff --git a/spec/bitcoin/bitcoin_spec.rb b/spec/bitcoin/bitcoin_spec.rb | |
index 0b42851..a766a57 100644 | |
--- a/spec/bitcoin/bitcoin_spec.rb | |
+++ b/spec/bitcoin/bitcoin_spec.rb | |
@@ -35,6 +35,10 @@ describe 'Bitcoin Address/Hash160/PubKey' do | |
.should == "0026f5494b39ea04b7bcb05e583acf3b0102d61f" | |
Bitcoin.hash160_from_address("11122RGUQSszAsTpptd2h8sdyYGR6nKs6f") | |
.should == "0000daec8d6f05e949710f202c4f73258aa7791e" | |
+ Bitcoin.hash160_from_address("11119uLoMQCBHmKevdsFKHMaUoyrwLa9Y") | |
+ .should == "00000090c66372823859c935149e2e32d276a1e6" |
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
loop do | |
addr = Bitcoin.generate_address | |
break if addr[0][1] == "1" | |
end | |
addr | |
Bitcoin.hash160_from_address(addr[0]) == addr[-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
"Michelangelo Altamore".split(' ').reverse().map(function(x) { return x.toLowerCase().substring(0,4)}).join('').substring(0,7) | |
// => "altamic" |
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
"Michelangelo Altamore".split(' ').reverse.map { |x| x.downcase[0,4]}.join[0,7] | |
# => "altamic" |
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
words = Hash.new | |
File.open("dictionary.txt", "r") do |file| | |
while line = file.gets | |
word = line.chomp | |
words[word.split('').sort!.join('')] += [word] | |
end | |
end | |
loop do |
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
# | |
# Ruby Example of the 'proof of work' explanation | |
# from https://en.bitcoin.it/wiki/Proof_of_work | |
# | |
# note: block data passed to do_work is simplified. | |
# bitcoin blockchain is more complex too. | |
# | |
require 'digest/sha2' |
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
# trick for checking syntax of ruby code | |
eval("BEGIN{return true}; #{code}") |
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
# lib/bitcoin/protocol/configuration.rb | |
Bitcoin::Protocol.configure do | |
register_constant :MAGIC, :production => [0xf9, 0xbe, 0xb4, 0xd9], | |
:test => [0xfa, 0xbf, 0xb5, 0xda] | |
register_constant :VERSION, 318 | |
register_constant :SUB_VERSION, '.1' | |
register_constant :SERVICES, { :node_network => 1 } |
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 sh | |
# bitdump.sh | |
# | |
# captures Bitcoin network traffic | |
SELF=`basename $0` | |
if [[ $1 = "" ]]; then | |
DEFAULT="en1" |