Skip to content

Instantly share code, notes, and snippets.

View iwiwi's full-sized avatar
🏠
Working from home

Takuya Akiba iwiwi

🏠
Working from home
View GitHub Profile
@iwiwi
iwiwi / sockets.rb
Last active December 17, 2015 16:39
#!/usr/bin/env ruby
#
# sockets.rb --- by Takuya Akiba (@iwiwi)
#
# Usage:
# sockets.rb PID
#
`ls -l /proc/#{ARGV[0]}/fd | grep [s]ocket`.scan(/\[([0-9]+)\]/).each_with_index do |m, i|
@iwiwi
iwiwi / crawler.rb
Last active September 20, 2023 10:58
Lightweight parallel web graph crawler
#!/usr/bin/env ruby
#
# crawler.rb --- Lightweight parallel web graph crawler
#
# Usage:
# ./crawler.rb START_URL TARGET_REGEXP
#
# Output:
# stdout --- edge list (tab separated URLs)
@iwiwi
iwiwi / WebGraphDecoder.java
Last active September 17, 2021 09:32
Download and decode WebGraph format graphs
import it.unimi.dsi.fastutil.ints.IntArrayFIFOQueue;
import it.unimi.dsi.fastutil.ints.IntArrays;
import it.unimi.dsi.logging.ProgressLogger;
import it.unimi.dsi.webgraph.GraphClassParser;
import it.unimi.dsi.webgraph.ImmutableGraph;
import it.unimi.dsi.webgraph.LazyIntIterator;
import java.io.*;
import java.util.*;
@iwiwi
iwiwi / qsub.rb
Last active April 27, 2016 06:13
Torque job machine-gun
#!/usr/bin/env ruby
#
# qsub.rb --- Torque job machine-gun
#
# Usage:
# 1. Rewrite the shell script template & parameters
# 2. Execute
# $ qsub.rb (cat) --> Output generated shell scripts
# $ qsub.rb sh --> Execute locally
@iwiwi
iwiwi / dblp.rb
Created April 8, 2013 12:37
DBLP dump parser for generating multiple networks
#!/usr/bin/env ruby
#
# dblp.rb --- Parse dblp.xml to generate graphs
#
# Usage:
# dblp.rb author <dblp.xml --> co-author network
# dblp.rb key cite <dblp.xml --> citation network
# dblp.rb key author <dblp.xml --> paper-author network
# dblp.rb key venue <dblp.xml --> paper-venue network