Skip to content

Instantly share code, notes, and snippets.

=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@pietrop
pietrop / issuu_downloader.rb
Created June 29, 2014 18:04
To download magazine from issuu.com when the download option has been disabled. in practice the script doesn't actually download the pdf, but rather download the images of the pages of the flash object and then combines those into a pdf
require 'mechanize'
require 'prawn'
=begin
running from terminal to download any pdf from issuu.com, given
- magazine name
- page count
- document-id
=end
=begin
`spoken_data_api_library.rb`
an attempt to make a SDK for the spoken data API.
spokenData API ruby unofficial SDK v1
@author : Pietro Passarelli
@date: 22/07/2015
@url: http://spokendata.com/api
## About
=begin
@date 23 July 2015
@author: pietro.passarelli@gmail.com
Given a CSV with two coulmns that have duplicate fields,
this script compares the two lists and returns a list of the duplicates,
and prints it out as text file.
run it as `ruby csv_2_list.rb name_of_the_csv_file_.csv`
=end
=begin
Convert sbv to CSV and Plain Text
To convert sbv files generated using youtube captioning to CSV and plain text format.
run from terminal as $ ruby sbv_to_csv.rb Captions.sbv
converts sbv file from youtube into csv file, doing also timecode conversion using timecode gem. from ie 0:09:07.730 to 00:09:07:18
=end
require 'csv'
require 'timecode'
## a script to config ubuntu EC2 instance with quickQuote. http://times.github.io/quickQuote/
## run the script form terminal in the ec2 instance using:
## ./config_ec2.sh
## you might need to adjust permissions to run it using:
## sudo chmod 600 ./config_ec2.sh
## http://dennissuratna.com/rails-deployment-aws1/
## http://dennissuratna.com/rails-deployment-aws2/
## http://dennissuratna.com/rails-deployment-aws3/
## Installs on the EC2 instance:
## ruby-2.0.0-p353
/**
* A way to simplify/automate the process of making a sails api, using blueprints.
* it takes a list of models you'd like to generate APIs for, and adds them to the sails app, through a system call.
* TODO: if you could also specify associations between models, this would make it amazingly quick to prototype a backend API.
*/
var spawn = require('child_process').spawn;
//A comma separate string list of models/resources you'd like to generate
var models = 'project, user, media, transcript, annotation, speaker, paperedit, papercut';
@pietrop
pietrop / transcribe.js
Created May 18, 2016 22:09 — forked from antiboredom/transcribe.js
Transcribe video/audio using IBM Watson
var request = require('request');
var fs = require('fs');
var sox = require('sox');
var spawn = require('child_process').spawn;
var WATSON_USER = '';
var WATSON_PASS = '';
var url = 'https://stream.watsonplatform.net/speech-to-text/api/v1/recognize';
@pietrop
pietrop / possible way to do open source speaker diarization with LIUM.md
Last active June 9, 2016 16:08
thinking out loud on a possible way to do speaker diarization module using LIUM
/**
* Minimal SDK to interact with spoken data's spekaer diarization service.
*
* This SDK I/O. works in two pars. first you send the video/audio receive a `uid`. that you can use to check status of transcription and retrieve json.
*
* Input: the API takes in a video or audio file (2048MB per file limit, file extensions: wav, mp3, mp4, ac3, avi, mpg, wmv, flv, mkv)
* output: a uid
*
* input: uid
* output: status of transcription is the first param returned. if `done` returns transcript/speaker diarization as second param.