Skip to content

Instantly share code, notes, and snippets.

View igolaizola's full-sized avatar

Iñigo Garcia Olaizola igolaizola

View GitHub Profile
@igolaizola
igolaizola / mercadona-sync-bookmarklet.html
Last active April 2, 2022 13:01
Mercadona sync tool
<a href='javascript:(function(){if (window.location.host == "tienda.mercadona.es") {c="";JSON.parse(localStorage.getItem("MO-cart")).lines.forEach(function(e) { c+="xc"+e.product_id+"a"+e.quantity+"ab"; });open("https://www.telecompra.mercadona.es/ns/principal.php?cart="+c);} else if (window.location.host == "www.telecompra.mercadona.es") {const params = new Proxy(new URLSearchParams(window.location.search), {get: (searchParams, prop) => searchParams.get(prop),}); document.cookie="cesta="+params.cart;location.reload();}})();'>
merca-sync
</a>
@igolaizola
igolaizola / gencacert.sh
Last active June 18, 2021 07:48
Generate a server certificate
#!/bin/bash
#
# Generate certificate
#
# Example local:
# ./gencacert.sh acme.dev "/C=US/ST=CA/L=Acme City/O=ACME/CN=acme.dev"
# Example remote:
# curl -sSfL https://gist.githubusercontent.com/igolaizola/0b3cbd306cbef6cfa7633100259ea65b/raw/gencacert.sh | bash -s acme.dev "/C=US/ST=CA/L=Acme City/O=ACME/CN=acme.dev"
#
# If you get an error similar to "Can't load /home/user/.rnd into RNG"
@igolaizola
igolaizola / bump-golang.sh
Created September 18, 2020 07:37
Bump Golang version (linux)
#!/bin/bash
LATEST=$(curl -s https://golang.org/dl/ | grep ".linux-amd64.tar.gz</span>" | sed -e 's/.*go\(.*\).linux.*/\1/')
CURRENT=$(go version | sed -e 's/.*go\(.*\) linux.*/\1/')
if [ $LATEST = $CURRENT ]; then
echo Golang version is up to date: $LATEST
else
echo Updating golang from $CURRENT to $LATEST
wget https://dl.google.com/go/go$LATEST.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go$LATEST.linux-amd64.tar.gz
@igolaizola
igolaizola / hdtls.go
Last active June 16, 2020 12:59
Hybrid DTLS: DTLS client connection that accepts client hello messages acting also as a DTLS server
package hdtls
import (
"bytes"
"context"
"errors"
"io"
"net"
"sync"
"time"
package http2buffer
import (
"bytes"
"crypto/tls"
"fmt"
"net"
"net/http"
"testing"
"time"
package main
import (
"fmt"
"time"
)
func main() {
test(1)
test(2)

Keybase proof

I hereby claim:

  • I am igolaizola on github.
  • I am igolaizola (https://keybase.io/igolaizola) on keybase.
  • I have a public key ASAHu_5Vkpju9aLJPI2VnMzaOCMYjREorRXjlQWtnavbGQo

To claim this, I am signing this object:

@igolaizola
igolaizola / EventSource.cs
Last active May 19, 2023 06:48
C# implementation of Server Side Event Source
/*
* Copyright 2014 Jonathan Bradshaw. All rights reserved.
* Redistribution and use in source and binary forms, with or without modification, is permitted.
*/
using System;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Linq;