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
# vi: set ft=ruby : | |
current_dir = File.basename(Dir.getwd) | |
$script = <<-SCRIPT | |
#!/usr/bin/env bash | |
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y dist-upgrade | |
apt-get install -y nodejs |
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
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'csv' | |
PAGE_URL = "https://www.wikipedia.org/" | |
LINK_NODE = "a" | |
CSV_FILE = "scraped-data.csv" | |
puts "Please wait. Scraping..." |
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
#!/bin/bash | |
current_extension="EXT" | |
new_name="file_name_" | |
new_extension="ext" | |
file_number=1 | |
echo "\nRenaming files ...\n" | |
for current_file in *."$current_extension" |
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
require 'sinatra' | |
def convert_title_to_filename string | |
string.gsub(' ','_').downcase + ".md" | |
end | |
get '/' do | |
erb :index | |
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
require 'sinatra' | |
get '/' do | |
erb :index | |
end | |
post '/' do | |
post_title = params[:post_title] | |
file_name = post_title.gsub! '\s+', '_' |