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
def procedure | |
puts 'Runnig...' | |
sleep 10 | |
end | |
File.open($0) do |io| | |
if io.flock(File::LOCK_EX|File::LOCK_NB) | |
procedure | |
else | |
puts 'Already running.' |
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
# Run tasks in parallel threads | |
class ParallelTasks | |
# Set max number of parallel threads | |
def initialize limit | |
@limit = limit | |
@ids = [] | |
@tasks = {} | |
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
Gem::Specification.new do |s| | |
# Required gemspec attributes | |
# author= | |
# authors= | |
# files | |
# name | |
# platform= | |
# require_paths= | |
# rubygems_version | |
# summary |
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
aligner | |
aligner-ruby | |
autocomplete-plus | |
cucumber | |
file-icons | |
git-timecop | |
highlight-selected | |
keyboard-scroll | |
language-docker | |
language-haml |
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
LOCAL_TUN_ADDRESS=10.0.0.0/24 | |
REMOTE_TUN_ADDRESS=10.0.1.0/24 | |
REMOTE_HOSTNAME=server-name.intranet | |
sudo socat -d TUN:"$LOCAL_TUN_ADDRESS",up 'EXEC:ssh -i '"$HOME/.ssh/id_rsa"' '"$USER"'@'"$REMOTE_HOSTNAME"' "sudo socat - TUN:'"$REMOTE_TUN_ADDRESS"',up"' |
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
DOMAIN=example.com | |
PORT=443 | |
echo | openssl s_client -connect $DOMAIN:$PORT 2>&1 | gawk '/-----BEGIN CERTIFICATE-----/{S=1}{if(S)print}/-----END CERTIFICATE-----/{exit}' > $DOMAIN.cer |
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
REPO="$HOME/src/dotfiles.git" | |
GITHUB_REPO_URL="git@github.com:fornellas/dotfiles.git" | |
mkdir -p "$REPO" | |
cd "$REPO" | |
git init --bare | |
cd - | |
alias dotfiles='git --git-dir="$REPO" --work-tree="$HOME"' | |
dotfiles remote add origin $GITHUB_REPO_URL | |
dotfiles pull origin |
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
# Ensure that all ruby process instances use Simplecov | |
task :simplecov_setup do | |
ENV['RUBYLIB'] = "#{Dir.pwd}:#{ENV['RUBYLIB']}" | |
ENV['RUBYOPT'] = '-r configure_simplecov' | |
sh 'rm -rf coverage/' | |
end | |
# Generate a final report, with all merged results | |
task :simplecov_report do | |
require 'simplecov' |
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 ruby | |
require 'socket' | |
require 'thwait' | |
unless ARGV.size == 2 | |
STDERR.puts "Usage: #{$PROGRAM_NAME} listen_address:listen_port target_address:target_port" | |
exit 1 | |
end | |
listen_address, listen_port = ARGV.shift.split(':') |
OlderNewer