Skip to content

Instantly share code, notes, and snippets.

Avatar

Arunan Skanthan siraskalot

View GitHub Profile
View Vagrantfile
# 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 Jun 26, 2016
Scrape a selection of links on a page
View screen_scrape.rb
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 Dec 18, 2015
Batch rename files and extensions - Bash script
View batch_rename_files_and_extension.sh
#!/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"
View gist:3355895
require 'sinatra'
def convert_title_to_filename string
string.gsub(' ','_').downcase + ".md"
end
get '/' do
erb :index
end
View gist:3355090
require 'sinatra'
get '/' do
erb :index
end
post '/' do
post_title = params[:post_title]
file_name = post_title.gsub! '\s+', '_'