Skip to content

Instantly share code, notes, and snippets.

@mutsuda
mutsuda / eldoblajeWidget.js
Last active October 21, 2023 19:57
Shows the total number of movies and shows you dubbed, the three latest added to your profile and shows the poster of the latest movie/show you dubbed as a background. All info extracted from "eldoblaje.com"
function extractFirstThreeTitles(html) {
const regex = /<a href="FichaPelicula\.asp\?id=\d+"[^>]*>(.*?)<\/a>/g;
let titles = [];
let match;
while ((match = regex.exec(html)) !== null && titles.length < 3) {
titles.push(match[1]);
}
// Read parameter from widget
let parameter = args.widgetParameter
var parameters = "";
if (parameter) parameters = parameter.split(";")
else
{
// If no parameters were found, ask the user to put them
let w = new ListWidget()
error = w.addText("Introduce tu cuenta y token de IndexaCapital separados por un ; en la configuración del Widget")
error.font = new Font("Avenir-Book", 11)
require 'Matrix'
class Matrix
public :"[]=", :set_element, :set_component
end
# Prints de Matrix
def print_matrix(m)
puts "----------"
print m[0,0] ? 1 : 0, " ", m[0,1] ? 1 : 0, " ", m[0,2] ? 1 : 0
@mutsuda
mutsuda / snapshot.js
Created February 23, 2020 21:21
Google Spreadsheet Financial Snapshot
function snapshot() {
// Assign 'today' today's date.
var today = Utilities.formatDate(new Date(), "GMT+1", "dd/MM/yyyy");
// Assign 'dashboard' the Dashboard sheet.
var dashboard = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Dashboard');
// Assign 'new_row' the first available row to write in.
var new_row = dashboard.getLastRow() + 1;
@mutsuda
mutsuda / toggle.vim
Created February 24, 2017 11:02
vim toggle
function! ToggleSyntax()
if exists("g:syntax_on")
syntax off
else
syntax enable
endif
endfunction
nmap <silent> ;s :call ToggleSyntax()<CR>
@mutsuda
mutsuda / hue_screen.rb
Last active August 15, 2016 19:17
Match the color of your Hue lights to what you are seeing on your Mac's screen
require 'hue'
require 'RMagick'
require 'ColorMath'
$path = "tmp/out.jpg"
$client = Hue::Client.new
def lights(h,s,l)
$client.lights.each do |light|
light.on!
light.hue = ((h/360)*65535).round
console.log('Simply.js demo!');
simply.on('singleClick', function(e) {
console.log(util2.format('single clicked $button!', e));
simply.subtitle('Has premut ' + e.button + '!');
});
simply.on('longClick', function(e) {
console.log(util2.format('long clicked $button!', e));
simply.vibe();
@mutsuda
mutsuda / gsearch.py
Last active January 2, 2016 01:29
Search keywords from a CSV file and put resulting links matching a certain criteria in another CSV file
import csv
import sys
import mechanize
import cookielib
import re
import time
# Creates a Browser instance
# and defines its headers
def createBrowser():
@mutsuda
mutsuda / mine_time.py
Last active December 15, 2015 15:38
This piece of code will keep track of a user's Minecraft gameplay minutes. Each time it is runed it writes into a log file the difference between the latest minutes with the actual minutes to obtain the total number of minutes played since the last execution.
import re
import os.path
import datetime
import os
import time
# Path to the minecraft statistics file
mine_path = "FULL_PATH_TO_/stats_user_unsent.dat"
@mutsuda
mutsuda / parser.py
Created December 25, 2011 10:55
Whatsapp conversation parser
# Position where the first character of a name is found in each line
start = 19
# File containing the watsapp conversation
file_name = "watext.txt"
def get_name(line):
end = line.find(":", start)
return line[start:end]