Skip to content

Instantly share code, notes, and snippets.

@andersonvom
andersonvom / vlsub.lua
Last active April 3, 2023 18:55
Lua script for VLC to download subtitles from OpenSubtitles.org
--[[
VLSub Extension for VLC media player 1.1 and 2.0
Copyright 2010 Guillaume Le Maout
Authors: Guillaume Le Maout
Contact: http://addons.videolan.org/messages/?action=newmessage&username=exebetche
Bug report: http://addons.videolan.org/content/show.php/?content=148752
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@andersonvom
andersonvom / replace.sh
Created February 19, 2013 17:20
Replace a given set of tokens for their respective values in a text file
#!/bin/bash
tokens="tokens.txt"
values="values.txt"
textfile="sample.txt"
paste $tokens $values | while read token value
do
sed -i -e "s/$token/$value/g" $textfile
done
@andersonvom
andersonvom / config.rb
Last active December 14, 2015 07:28
Monitor Correios (correios.com.br) website for update on shipping information. Set up FROM_EMAIL and TO_EMAIL and just put it in your crontab or do a while;true bash loop: $ ruby correios.rb <TRACKING_ID>
#!/usr/bin/ruby
require 'mail'
GMAIL_USERNAME = "username"
GMAIL_PASSWORD = "password"
options = { :address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
@andersonvom
andersonvom / Vagrantfile
Created May 1, 2013 22:39
Devstack and opencafe development environment setup with vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "4096"]
@andersonvom
andersonvom / checkmate-svr.sh
Last active December 17, 2015 14:09
Stop Checkmate
#
# Function that stops the daemon/service
#
do_stop()
{
if [ ! -e $PIDFILE ]; then
return 2
fi
pid=`cat $PIDFILE`
children=$(ps axo pid,ppid | awk "{ if ( \$2 == $pid ) { print \$1 }}")
@andersonvom
andersonvom / sample-test.js
Created July 18, 2013 19:39
Sample jasmine test
describe('#method_name', function() {
beforeEach(function() {
// Set up
});
it('should do something', function() {
expect('pending').toBe('complete');
});
// more tests...
@andersonvom
andersonvom / test.py
Created July 18, 2013 21:30
Sample test
# Testing deployment/router.py # get_deployments
def test_filter_by_name(self):
self.mox.StubOutWithMock(bottle.request.query, "get")
self.mox.StubOutWithMock(bottle.request.query, "getall")
self.mox.StubOutWithMock(self.manager, "get_deployments")
# FIXME: I just want to get the test to pass first
bottle.request.query.get('show_deleted').AndReturn('')
bottle.request.query.getall('statuses').AndReturn([])
var test = [1,2,3,4,5];
var tr = d3.select(".cm-workflow").selectAll("p")
.data(test)
.enter().append("p").attr('text', function(d) { return d });
var test = [5,4,3,2,1];
var tr = d3.select(".cm-workflow").selectAll("p")
.data(test)
@andersonvom
andersonvom / gitstats.rb
Created November 28, 2013 18:43
Gather statistics on GIT projects regarding number of commits, lines of code (insertions/deletions), and files changed.
DATE="2013-10-28 00:00:00"
METRIC=:total_loc
TEAM=[
'Team Member #1',
'Team Member #2',
'Team Member #3',
# ...
]
{
"stack": {
"capabilities": [],
"creation_time": "2014-02-19T16:04:56Z",
"description": "AWS CloudFormation Sample Template WordPress_Single_Instance: WordPress is web software you can use to create a beautiful website or blog. This template installs a single-instance WordPress deployment using a local MySQL database to store the data.",
"disable_rollback": true,
"id": "None",
"links": [
{
"href": "http://10.0.2.15:8004/v1/2e327e5e7fa94b25a44be66fd9d1ec4d/stacks/foobar1/None",