Skip to content

Instantly share code, notes, and snippets.

@brianburridge
brianburridge / ruby_ftp_example.rb
Last active August 30, 2019 14:46 — forked from 3dd13/ruby_ftp_example.rb
Sample code of using Ruby Net::FTP library. Login to FTP server, list out files, check directory existence, upload files
require 'net/ftp'
CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk"
CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login"
CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password"
# LOGIN and LIST available files at default home directory
Net::FTP.open(ENV['CONTENT_SERVER_DOMAIN_NAME'], ENV['CONTENT_SERVER_FTP_LOGIN'], ENV['CONTENT_SERVER_FTP_PASSWORD']) do |ftp|
ftp.login
@brianburridge
brianburridge / wordpressxml2jekyll.rb
Last active June 23, 2023 15:38 — forked from rzhw/wordpressxml2jekyll.rb
Convert Wordpress xml export to Jekyll format using Markdown
#!/usr/bin/env ruby
# Input: WordPress XML export file.
# Outputs: a series of Markdown files ready to be included in a Jekyll site,
# and comments.yml which contains all approved comments with metadata which
# can be used for a Disqus import.
# Changes from the original gist: http://gist.github.com/268428
# 1. Handles titles containing special characters. Those have to be YAML escaped
# 2. Use the original permalinks in wordpress.