Skip to content

Instantly share code, notes, and snippets.

View philiphacks's full-sized avatar

Philip philiphacks

  • Arkadiko
View GitHub Profile
@philiphacks
philiphacks / liquid_gas.rb
Last active March 25, 2022 20:41
Calculates gas fees spent of last 365 days of Liquid blocks
start_block = 1224982
end_block = 1761473
total_gas = 0
while start_block <= end_block
blocks_short = HTTParty.get("https://blockstream.info/liquid/api/blocks/#{start_block}").parsed_response
blocks_short.each do |block_short|
puts "querying block #{block_short['id']}"
response = HTTParty.get("https://blockstream.info/liquid/api/block/#{block_short['id']}/txs/0").parsed_response
gas_block = 0
@philiphacks
philiphacks / rsk_gas.rb
Last active March 25, 2022 19:06
Calculates gas fees spent of last 365 days of RSK blocks
require 'net/http'
require 'uri'
require 'json'
uri = URI.parse("https://public-node.rsk.co")
request = Net::HTTP::Post.new(uri)
request.content_type = "application/json"
start_block = 3184009
end_block = 4184009
@philiphacks
philiphacks / gist:5348872
Created April 9, 2013 19:59
Node.js chatbox benchmark using Express.js and Socket.io (WebSockets)
Philip-De-Smedts-MacBook:live_streaming_node philip$ node --prof --prof_lazy --log app.js
info - socket.io started
Listening on port 3000
U: 1, MR/S: 1, MS/S: 1, MR/S/U: 1, MS/S/U: 1
U: 3, MR/S: 2, MS/S: 2, MR/S/U: 0.7, MS/S/U: 0.7
U: 5, MR/S: 2, MS/S: 2, MR/S/U: 0.4, MS/S/U: 0.4
U: 7, MR/S: 3, MS/S: 3, MR/S/U: 0.4, MS/S/U: 0.4
U: 9, MR/S: 4, MS/S: 4, MR/S/U: 0.4, MS/S/U: 0.4
U: 11, MR/S: 2, MS/S: 2, MR/S/U: 0.2, MS/S/U: 0.2
U: 13, MR/S: 5, MS/S: 5, MR/S/U: 0.4, MS/S/U: 0.4
@philiphacks
philiphacks / gist:5313269
Last active December 15, 2015 19:39
Rails 4 Live Streaming Chatbox using the Rainbows! web server
PID COMMAND %CPU TIME #TH #WQ #POR #MREG RPRVT RSHRD RSIZE VPRVT VSIZE PGRP PPID STATE UID FAULTS COW MSGSENT
2271 ruby 78.9 00:08.81 2/1 0 14 220- 61M- 24M 66M- 85M- 2457M- 2268 2268 running 501 34408+ 3825 22 10
2270 ruby 86.0 00:08.85 2/1 0 14 222- 61M- 24M 66M- 85M- 2457M- 2268 2268 running 501 34515+ 3868 22 10
2268 ruby 0.0 00:01.13 2 0 35 121 612K 23M 22M 10M 2403M 2268 405 sleeping 501 6278 374 143 64
Philip-De-Smedts-MacBook:live_streaming philip$ ab -r -n 10000 -c 100 -T 'application/x-www-form-urlencoded' -p ../live_streaming/post http://127.0.0.1:8080/messages
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
@philiphacks
philiphacks / gist:5309531
Last active December 15, 2015 19:10
Rails 4 Live Streaming Chatbox using the Puma web server with a default of 16 maximum threads
PID COMMAND %CPU TIME #TH #WQ #POR #MREG RPRVT RSHRD RSIZE VPRVT VSIZE PGRP PPID STATE UID FAULTS COW MSGSENT
8014 ruby 99.9 00:50.38 35/1 0 56+ 301+ 75M+ 216K 80M+ 169M+ 2542M+ 8014 6329 running 501 101974+ 368 195
Philip-De-Smedts-MacBook:live_streaming_node philip$ ab -r -n 10000 -c 100 -T 'application/x-www-form-urlencoded' -p ../live_streaming/post http://127.0.0.1:3000/messages
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)