Skip to content

Instantly share code, notes, and snippets.

View HQ063's full-sized avatar

Gonzalo Muñoz HQ063

View GitHub Profile
@HQ063
HQ063 / keybase.md
Created July 28, 2022 20:13
keybase.md

Keybase proof

I hereby claim:

  • I am hq063 on github.
  • I am hq063 (https://keybase.io/hq063) on keybase.
  • I have a public key ASCU8LNHXGWQDK-J8DJDYxs0swzrRBbH0pRf5GGSzJy0Ywo

To claim this, I am signing this object:

@HQ063
HQ063 / covid19_per_million.html
Last active July 8, 2020 12:54
COVID19 Data by Million Inhabitants
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
<!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/papaparse@5.1.1/papaparse.min.js" integrity="sha256-X3LxH9hl4jSRLdC8GsHBNuT97cVgZed+NBsZwW/J5wI=" crossorigin="anonymous"></script>
<script>
// Population (manually built from https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_population)
// ==UserScript==
// @name Subtitulos!
// @namespace evolution9
// @description Boton para bajar subtitulos en trakt.tv
// @include https://trakt.tv/dashboard
// @include https://trakt.tv/users/hq063/progress/watched/activity
// @version 1
// @grant none
// @run-at document-idle
// ==/UserScript==
@HQ063
HQ063 / bgg.user.js
Last active September 1, 2017 15:58
BGG Greasemonkey script
// ==UserScript==
// @name BGG Quickbar
// @namespace hq063
// @include https://boardgamegeek.com/
// @include https://boardgamegeek.com/*
// @include https://www.boardgamegeek.com/
// @include https://www.boardgamegeek.com/*
// @version 1
// @grant GM_getValue
// @grant GM_setValue
@HQ063
HQ063 / file_tail.rb
Created July 18, 2017 01:39
File tail
class IO
def tail(n)
return [] if n < 1
if File.size(self) < ( 1 << 16 )
tail_buf_length = File.size(self)
return self.readlines.reverse[0..n-1]
else
tail_buf_length = 100
end
self.seek(-tail_buf_length,IO::SEEK_END)
@HQ063
HQ063 / QR_Itunes.user.js
Created May 24, 2017 15:54
Add a QR code for current url into web itunes, so you can scan it on ios device
// ==UserScript==
// @name QR Itunes
// @namespace hq063
// @include https://itunes.apple.com/app/*
// @version 1
// @grant none
// ==/UserScript==
$(function() {
$("body").append("<img src='https://api.qrserver.com/v1/create-qr-code/?size=200x200&data="+window.location.href+"' style='display: block; background: red; width: 200px; height: 200px; top: 80px; left: 10px; position: absolute;'>")
@HQ063
HQ063 / benchmark.rb
Created September 20, 2014 01:38
Simple benchmarking method
def benchmark(times)
dt = DateTime.now
times.times do |j|
yield
end
puts ((DateTime.now - dt) * 24 * 60 * 60).to_f.to_s + " seconds"
end
@HQ063
HQ063 / multiple_callback.rb
Created September 20, 2014 01:35
MultipleCallback: A class for allowing a ruby method to receive more than one block in an easy and easy reading way
class MultipleCallback
def initialize(block)
@callbacks = Hash.new
block.call self
end
def on(symbol, &block)
@callbacks[symbol] = block
end
irb(main):043:0> average_ratings = Hash.new{ |hash, key| hash[key] = { :average_rating => 0, :number_of_voters => 0 } }
=> {}
irb(main):044:0> average_ratings.has_key?(:lala)
=> false
irb(main):045:0> average_ratings[:lala]
=> {:average_rating=>0, :number_of_voters=>0}
irb(main):046:0> average_ratings.has_key?(:lala)
=> true
irb(main):048:0> average_ratings = Hash.new( { :average_rating => 0, :number_of_voters => 0 } )