Skip to content

Instantly share code, notes, and snippets.

View siraskalot's full-sized avatar

Arunan Skanthan siraskalot

View GitHub Profile
@siraskalot
siraskalot / Vagrantfile
Created August 16, 2018 07:04
Vagrant config
# 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
@siraskalot
siraskalot / screen_scrape.rb
Created June 26, 2016 10:37
Scrape a selection of links on a page
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..."
@siraskalot
siraskalot / batch_rename_files_and_extension.sh
Last active December 18, 2015 08:20
Batch rename files and extensions - Bash script
#!/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"
require 'sinatra'
def convert_title_to_filename string
string.gsub(' ','_').downcase + ".md"
end
get '/' do
erb :index
end
require 'sinatra'
get '/' do
erb :index
end
post '/' do
post_title = params[:post_title]
file_name = post_title.gsub! '\s+', '_'