Skip to content

Instantly share code, notes, and snippets.

View jmcarbo's full-sized avatar

Joan Marc Carbo jmcarbo

  • -
  • Barcelona (SPAIN)
View GitHub Profile
CmdUtils.CreateCommand({
name: "gist-credentials",
//takes: {"login_name": noun_arb_text},
modifiers: {"login_name": noun_arb_text, "tok": noun_arb_text},
homepage: "http://www.sample.me.uk/ubiquity/",
author: { name: "Duncan Sample" },
description: "Sets the login credentials for github",
help: "service should be either 'delicious' or 'magnolia'",
license: "MPL",
preview: function( pblock ) {
/* This is a template command */
CmdUtils.CreateCommand({
name: "publicprbb",
icon: "http://example.com/example.png",
homepage: "http://example.com/",
author: { name: "Your Name", email: "you@example.com"},
license: "GPL",
description: "Em mostra les reserves de sales",
help: "how to use your command",
takes: {"input": noun_arb_text},
//Searches Catalan words at Enciclopedia Catalana dictionary page
CmdUtils.makeSearchCommand({
name: "diccionari-català",
url: "http://ec.grec.net/cgi-bin/AppDLC3.exe?APP=CERCADLC&GECART={QUERY}"
});
function myText(textFormat) {
// get the active document in a secure way
var doc = CmdUtils.getDocument();
var commenters = "";
jQuery(doc.body).find('.comment-block h4 a').each(
function(i){
if(!/img/i.test(this.innerHTML)){
commenters += '@<b>' + this.innerHTML + '</b>: gràcies - gracias - thanks.';
if(textFormat) {
@jmcarbo
jmcarbo / backupdvd.rb
Created August 1, 2009 21:01
Backup directory to DVD
#!/usr/bin/ruby
#Backup directory to DVD
require 'fileutils'
if !ARGV[1]
puts "Usage: backupdvd.rb <Directory to backup> <disk no>"
exit
end
# rubysrvc.rb
require 'rubygems'
require 'win32/service'
require 'win32/daemon'
include Win32
SERVICE_NAME = "RubySvc"
SERVICE_DISPLAYNAME = "A Ruby Service"
#
# sample program of expect.rb
#
# by A. Ito #
# This program reports the latest version of ruby interpreter
# by connecting to ftp server at netlab.co.jp.
#
require 'pty'
require 'expect'
#
# sample program of expect.rb
#
# by A. Ito #
# This program reports the latest version of ruby interpreter
# by connecting to ftp server at netlab.co.jp.
#
require 'pty'
require 'expect'
cat ~/.ssh/id_rsa.pub | ssh administrador@192.168.150.19 'mkdir ~/.ssh;chmod 700 ~/.ssh;touch ~/.ssh/authorized_keys2;chmod 600 ~/.ssh/authorized_keys2;cat - >> .ssh/authorized_keys2 '
def random_password(size = 8)
chars = (('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a) - %w(i o 0 1 l 0)
(1..size).collect{|a| chars[rand(chars.size)] }.join
end
puts random_password.inspect