This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Toggle the state (STOPPED/RUNNING) of a process, clicking to its window. | |
set -e | |
debug() { echo "$@" 2>&1; } | |
die() { local MESSAGE=$1 | |
debug "Error: $MESSAGE" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pure functional implementation of D'Hondt method | |
from itertools import islice, count | |
from collections import Counter | |
from heapq import merge | |
def percentage(numerator, denominator): | |
return 100.0 * numerator / denominator | |
def take(n, it): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.annotation.Target; | |
import java.lang.annotation.Retention; | |
import java.lang.annotation.RetentionPolicy; | |
import java.lang.annotation.ElementType; | |
import java.lang.reflect.Method; | |
@Target(ElementType.METHOD) | |
@Retention(RetentionPolicy.RUNTIME) | |
@interface MyAnnotation { | |
String name() default ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Return sum of numbers in array xs */ | |
function sum(xs) { | |
return xs.reduce(function(a, b) { return a + b }, 0); | |
} | |
/* Return true if string s is a valid DNI */ | |
function validateDNI(s) { | |
var control_letters = 'TRWAGMYFPDXBNJZSQVHLCKE'; | |
var regexp = /^[\dKLMXYZ]\d{7}[A-Z]$/; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import signal | |
from PyQt4 import QtCore, QtGui, QtWebKit | |
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkCookieJar, QNetworkCookie | |
class ExtendedNetworkCookieJar(QNetworkCookieJar): | |
def mozillaCookies(self): | |
""" | |
Return all cookies in Mozilla text format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'capybara' | |
# $ xvfb-run rspec -f documentation chrome-extension_spec.rb | |
# | |
# ./myext -- Directory containing the unpacked extension | |
class ChromeBrowser | |
include Capybara::DSL | |
def initialize(chrome_flags = {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name DeezerCLI | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Control Deezer web player from the console | |
// @author pyarnau@gmail.com | |
// @match http://www.deezer.com/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e -u -o pipefail | |
# Usage: Export a cookies.txt file from a browser logged-in in timeline.google.com with some | |
# add-on/extension (i.e. Export cookies, Get cookies.txt). Now run the script for the | |
# desired period: | |
# | |
# $ bash google-timeline-download.sh cookies.txt 2022-01-01 2022-02-20 out.kml | |
# | |
# Dependencies: curl, perl-xml-twig. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es"> | |
<head> | |
<title>Testing DataTable/ColOrder with async call</title> | |
<script src="http://code.jquery.com/jquery-1.12.4.js"></script> | |
<script src="http://nightly.datatables.net/js/jquery.dataTables.min.js"></script> | |
<script src="http://nightly.datatables.net/colreorder/js/dataTables.colReorder.js"></script> | |
<script> | |
$(document).ready(function() { | |
var table = $('#example').DataTable({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es"> | |
<head> | |
<title>Simple functional app using VirtualDom</title> | |
<script src="http://wzrd.in/standalone/virtual-dom@latest"></script> | |
<script src="simple_virtual_dom.js"></script> | |
<script src="incrementor.js"></script> | |
</head> | |
<body> | |
<div id="incrementor"> |