Skip to content

Instantly share code, notes, and snippets.

@avivo
avivo / diigo-oneclick-bookmarklet.js
Created March 20, 2011 21:02
A bookmarklet to make a diigo bookmark with a default tag with one click.
javascript:
/* Usage:
Copy the contents of this file and paste into the url of a new bookmark to make the bookmarklet.
Click the bookmarklet to make a Diigo bookmark to the current page with the tag 'oneclick'. It will bring up a popup, which will close 2 seconds after you click anywhere on the bookmarked page, or after you leave the bookmarked page.
Feel free to edit and improve, this was just a quick hack.
*/
(function(){
var path = 'https://secure.diigo.com/api/v2/bookmarks';
var params = {
@avivo
avivo / simple_testing.rb
Created April 5, 2011 02:52
Simple inline nonblocking testing without dependencies, and with readable stack traces
TESTING = true
def clean_backtrace(e)
puts "\t" + e.backtrace.reject{|t| t =~ /(assert_equal|[(\/]irb[.:\/)])/}.join("\n\t")
end
def assert_equal a, b
begin
raise if TESTING and a != b
rescue Exception => e
puts "*** Assertion failed: ***\n #{a} not equal to #{b}"
clean_backtrace(e)
@avivo
avivo / greplin-bookmarklet.js
Created April 18, 2011 16:23
A bookmarklet that searches greplin with the current page's search terms and displays the results at the top of the page.
javascript:
/* Usage:
Copy the contents of this file and paste into the url of a new bookmark to make the bookmarklet.
Click the bookmarklet after searching on a site like google to search greplin with the current search terms - the result will show up in a frame at the top of the page.
This is intended to work with google (but not google instant), and will also work with any site with url's of the same form.
This was a quick hack (tested in chrome 10).
*/
(function(){
var search_terms = document.URL.match(/q=[^&]*/)[0];
@avivo
avivo / mobileworks_api_wrapper.rb
Created June 11, 2013 02:31
A simple (only slightly hacky) ruby wrapper for some of the mobileworks.com crowdsourcing api.
require 'json'
# LOGIN = 'username:password'
# Calls curl with the given (string) arguments and returns the resulting parsed json as a ruby object.
def curl_json(args)
# TODO: add error checking
call = "curl #{args}"
puts call
response = `#{call}`

Keybase proof

I hereby claim:

  • I am avivo on github.
  • I am aviv (https://keybase.io/aviv) on keybase.
  • I have a public key ASD6oFd4gD4h0Xuuq6PVSjXezcnBSWpxTu1-HTbXMWiNOAo

To claim this, I am signing this object:

from pptx import Presentation
import argparse
import re
from termcolor import colored as c
# Bash one liner version to get a similar thing:
# unzip -p presenation.pptx | sed -e 's/<[^>]*>//g' | tr '\r' '\n' | egrep --colour '[0-9]*$'
def parse_args():