Skip to content

Instantly share code, notes, and snippets.

View narutaro's full-sized avatar
:octocat:
On vacation

narutaro narutaro

:octocat:
On vacation
View GitHub Profile
@narutaro
narutaro / cron with rbenv.md
Last active April 14, 2022 09:26
cron with rbenv

cron does not work with rbenv?

If your cron does not work, in many cases, that's because enviromental value.

Check your environmental values

You use rbenv and created some ruby scripts. Now you want to set it to cron.

43 19 * * * ruby your_ruby_script.rb
@narutaro
narutaro / Python vs. Ruby.md
Last active February 12, 2016 22:25
Grumbles of a rubyist who tries to learn python

Grumbles of a rubyist who tries to learn python

Create a unique list of lists/array of arrays - the winner is ruby

ruby

[1] pry(main)> a = [[1, 2],[1,2],[3,4]]
=> [[1, 2], [1, 2], [3, 4]]
[2] pry(main)> a.uniq
=> [[1, 2], [3, 4]]
@narutaro
narutaro / vim tips.md
Created February 5, 2016 06:45
vim tips

write a read-only file after modifiying some

:w !sudo tee % > /dev/null
@narutaro
narutaro / table test.md
Last active February 28, 2016 21:55
table test

Gistlog supports github markdown style table. A table looks like this.

ft-Aligned Center Aligned Right Aligned
col 3 is some wordy text $1600
col 2 is centered $12
zebra stripes are neat $1
@narutaro
narutaro / nprobe.md
Created January 23, 2016 01:42
nprobe
nprobe --collector-port 6789 --dump-path /nprobe
@narutaro
narutaro / flowgen.md
Last active January 22, 2016 22:03
flowgen

The best NetFlow generator flowgen

me@vaio:~/NetFlow-Generator$ time ./flowgen -p 5555 -i 1 --dstaddr 1.1.1.1 -n 1000000 10.40.8.240 
collector = 10.40.8.240
count     = 1000000
spoof     = (none)
port      = 5555
wait      = 0 (msec)
interval = 1
@narutaro
narutaro / tcpreplay.md
Created January 5, 2016 04:58
tcpreplay

Usage

root@tcpreplay:/tcpreplay# tcpreplay -i eth0 -K --mbps 10 smallFlows.pcap 
File Cache is enabled
Actual: 14261 packets (9216531 bytes) sent in 7.03 seconds.
Rated: 1249999.6 Bps, 9.99 Mbps, 1934.15 pps
Flows: 1209 flows, 163.97 fps, 14243 flow packets, 18 non-flow
Statistics for network device: eth0
	Attempted packets:         14261
	Successful packets: 14261
@narutaro
narutaro / mkmf (LoadError).md
Created January 4, 2016 19:46
mkmf (LoadError)

#Symptom

# gem install rest-client
Fetching: unf_ext-0.0.7.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing rest-client:
	ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
@narutaro
narutaro / pmacct.md
Last active January 5, 2016 00:44
pmacct

#Preparing a docker container

Use a docker container to setup pmacct. Port 5678/udp for receiving NetFlow.

$ docker run -d -h pmacct --name=pmacct -p 8889:8889 -p 5678:5678/udp -v /home/inoue/docker/pmacct:/pmacct -it ubuntu

Build essentials.

apt-get install build-essential checkinstall
@narutaro
narutaro / Best open source NetFlow collector.md
Last active October 23, 2024 14:43
Best open source NetFlow collector

#Open source NetFlow collector ##Over ten years players ###nfsen family - nfpcapd nfsen has very stable and well-accumulated feature set. It provides full-stack of NetFlow feature. NetFlow collector daemon nfpcapd, flow dump file operation tool nfdump and Web front-end nfsen. Community is still avtive.

###ntop-ng family - nprobe

###pmacct family- pmacctd Momory table is something that I want to try.