Skip to content

Instantly share code, notes, and snippets.

View alg's full-sized avatar

Aleksey Gureiev alg

View GitHub Profile

This is a very rough script to export your octopress files to Ghost. You will still need to check your data but it will give you a head start. Feel free to fork and optimize the script for your purpose.

The following should be considered:

  1. You need to execute the script in the source/_posts directory
  2. You need to manually copy all the images to /var/www/ghost/content/images
  3. Images with external URLs are not handled
  4. Blockquotes have their issues
  5. Lists are not exported correctly
@alg
alg / remove_db_dump.rake
Created April 30, 2014 18:06
Remove db:structure:dump
# Place it in lib/tasks/
env = ENV['RACK_ENV'] || ENV['RAILS_ENV']
if env == 'production' || env == 'staging'
Rake::TaskManager.class_eval do
def remove_task(task_name)
@tasks.delete(task_name.to_s)
end
end
@alg
alg / a.rb
Last active August 29, 2015 14:10
module M
def m
puts "module"
end
end
class A
def m
puts "class"
end
- request:
method: post
uri: https://spidev.isi.deterlab.net:52323/axis2/services/Experiments.ExperimentsHttpsSoap11Endpoint/
body:
encoding: UTF-8
string: <?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.testbed.deterlab.net/xsd"
xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><tns:addExperimentAspects><tns:eid>Alfa-Romeo:ExperimentOne</tns:eid><tns:aspects><tns:type>layout</tns:type><tns:data>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8+CjxleHBlcmltZW50PgogPHZlcnNpb24+MS4wPC92ZXJzaW9uPgogPHN1YnN0cmF0ZXM+CiAgPG5hbWU+bGluazI8L25hbWU+CiAgPGNhcGFjaXR5PgogICA8cmF0ZT4xMDAwMDAuMDAwMDAwPC9yYXRlPgogICA8a2luZD5tYXg8L2tpbmQ+CiAgPC9jYXBhY2l0eT4KIDwvc3Vic3RyYXRlcz4KIDxzdWJzdHJhdGVzPgogIDxuYW1lPmxpbmswPC9uYW1lPgogIDxjYXBhY2l0eT4KICAgPHJhdGU+MTAwMDAwLjAwMDAwMDwvcmF0ZT4KICAgPGtpbmQ+bWF4PC9raW5kPgogIDwvY2FwYWNpdHk+CiA8L3N1YnN0cmF0ZXM+CiA8c3Vi
<!-- Created experiment -->
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://api.testbed.deterlab.net/xsd" xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<tns:createExperiment>
<tns:eid>Beta-Test:Test-Exp</tns:eid>
<tns:owner>spyromus</tns:owner>
<tns:accessLists>
<tns:circleId>Beta-Test:Beta-Test</tns:circleId>
class Polynomial
def initialize(coefs)
if coefs.nil? || !coefs.kind_of?(Array) || coefs.size < 2
raise ArgumentError, "Need at least 2 coefficients."
end
@coefs = coefs
end
@alg
alg / maze.rb
Created December 28, 2009 13:16
class Maze
WALL = '#'
EMPTY = ' '
attr_reader :steps
def initialize(spec)
@spec = spec.split("\n").map { |line| line.split('') }
solve
class GlobalRESTController < ApplicationController
def index
@objects = model_class.all
respond_to do |format|
format.html
format.xml { render :xml => @objects }
end
end
require 'utils'
require 'swap'
# A very simple algorithm based on incremental balancing of job queues.
# Initially, the first queue has all the jobs that are gradually distributed
# across available queues. The algorithm doesn't take much memory since it
# does not involve the recursive traversing of the options tree and
# doesn't store lots of intermediate data.
class FairDistribution
require 'test_helper'
class StaticPagesControllerTest < ActionController::TestCase
%w( faq about privacy terms_and_conditions ).each do |page|
should_route :get, "/#{page}", :controller => :static_pages, :action => page.to_sym
context "Accessing #{page} page" do
setup { get page }
should_respond_with :success