Skip to content

Instantly share code, notes, and snippets.

Arash Badie Modiri arashbm

Block or report user

Report or block arashbm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@arashbm
arashbm / PCAP-JSON.md
Last active Oct 30, 2018
PCAP JSON Packet and Flows
View PCAP-JSON.md

Use these scripts to turn tshark JSON file (tshark -r blaah.pcap -T json > packets.json) to packet and flow csv files.

Usage

parse_pcap_json.py produces a space-seperated file with one packet per row.

python3 parse_pcap_json.py packets.json > packets.csv
@arashbm
arashbm / keybase.md
Created Feb 2, 2018
Keybase new proof
View keybase.md

Keybase proof

I hereby claim:

  • I am arashbm on github.
  • I am arashbm (https://keybase.io/arashbm) on keybase.
  • I have a public key ASBhL23mmknHxFNqG606hQ-wLozWyPVU0cTQgFKgwax6MAo

To claim this, I am signing this object:

View licenses.rb
require 'json'
JSON.parse(ARGF.read).map do |package, value|
package_name = package.split('@')[-2]
puts "\n"
if value["url"]
puts "[#{package_name}](#{value["url"]})"
puts "="*(package_name.length + value["url"].length + 4)
@arashbm
arashbm / README.markdown
Last active Aug 29, 2015
Heram (Pyramid Scheme)
View README.markdown

Heram Simulator

This is a quick attempt to participate in Jadi's contest. If this gist doesn't make any sense to you, just ignore it :)

Usage example: ruby heram.rb 1 2 6 6 70_000_000 4 for instructions, run without arguments (ruby heram) or just read the source!

human readable results will be printed on STDERR, Comma Separated Value (CSV) format will be printed to STDOUT, so you can ruby heram.rb 1 2 6 6 70_000_000 4 > results.csv and maybe xdg-open results.csv to plot it with your program of choice :)

With Gnuplot installed you can do something like this: ruby heram.rb 1 2 6 6 70_000_000 4 | gnuplot "plot.gp" > test.png && xdg-open test.png to generate a plot with Gnuplot file (plot.gp) provided here.

@arashbm
arashbm / master.rb
Created Oct 14, 2012
MapReduce Concept With Ruby
View master.rb
# This is our given particle
given_particle = { :x => 0.0, :y => 0.0, :m => 1}
# Generating random data
particles = Array.new
50.times do
# rand is a function that generates random number between 0 and 1
x = (rand - 0.5) * 1000
y= (rand - 0.5) * 1000
@arashbm
arashbm / all.rb
Created Jul 18, 2012
Download all railscasts.com videos
View all.rb
require 'nokogiri'
require 'open-uri'
# Downloads all free railscasts.com screencasts in current directory
# just `ruby all.rb` and you're done
# if you want another format change it from m4v at the end of line 11
(202..360).each do |i|
puts i
doc = Nokogiri::HTML(open("http://railscasts.com/episodes/#{i}"))
doc.css('//a').each do |a|
You can’t perform that action at this time.