Skip to content

Instantly share code, notes, and snippets.

View aldoborrero's full-sized avatar

Aldo aldoborrero

View GitHub Profile
@aldoborrero
aldoborrero / main.go
Created September 14, 2023 10:36
hd-wallet-generator
package main
import (
"crypto/rand"
"encoding/hex"
"encoding/json"
"fmt"
"github.com/alecthomas/kong"
"github.com/ethereum/go-ethereum/crypto"
"github.com/pelletier/go-toml"
@aldoborrero
aldoborrero / README.md
Created November 25, 2022 21:03
How to setup a Nix binary cache with Terraform in DigitalOcean Spaces + CDN and custom subdomain in Cloudflare
@aldoborrero
aldoborrero / cloudflare.tf
Created November 25, 2022 20:57
How to setup a Nix binary cache in DigitalOcean Spaces + CDN, with custom domain in Cloudflare with Terraform
locals {
domain = "example.com"
}
data "cloudflare_zone" "domain" {
name = local.domain
}
resource "tls_private_key" "nix_store_origin_key" {
algorithm = "RSA"
@aldoborrero
aldoborrero / BluetoothCompat.java
Last active October 16, 2016 18:28
This class is a helper for performing Bluetooth operations in a reactive way. Part of this code is extracted and inspired from library RxBluetooth, created by Addenie (https://github.com/adennie/RxBluetooth/blob/master/rxbluetooth/src/main/java/com/andydennie/rxbluetooth/RxBluetooth.java). License of all files contained in this gist is Apache 2.0.
public class BluetoothCompat {
public static boolean createBondCompat(final BluetoothDevice device)
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return device.createBond();
} else {
Method method = device.getClass().getMethod("createBond", (Class[]) null);
final Object invoke = method.invoke(device, (Object[]) null);
return (Boolean) invoke;
@aldoborrero
aldoborrero / BluetoothCompat.java
Created October 14, 2016 14:23
This class is a helper for performing Bluetooth operations in a reactive way. Part of this code is extracted from library RxBluetooth created Addenie (https://github.com/adennie/RxBluetooth/blob/master/rxbluetooth/src/main/java/com/andydennie/rxbluetooth/RxBluetooth.java)
public class BluetoothCompat {
public static boolean createBondCompat(final BluetoothDevice device)
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return device.createBond();
} else {
Method method = device.getClass().getMethod("createBond", (Class[]) null);
final Object invoke = method.invoke(device, (Object[]) null);
return (Boolean) invoke;
@aldoborrero
aldoborrero / BugfenderTree.java
Created April 18, 2016 13:02
Bugfender Timber Tree
public class BugfenderTree extends Timber.Tree {
@Override protected void log(int priority, String tag, String message, Throwable t) {
switch (priority) {
case Log.VERBOSE:
Bugfender.d(tag, message);
break;
case Log.DEBUG:
Bugfender.d(tag, message);
break;
@aldoborrero
aldoborrero / RuntimeRegexTypeAdapterFactory.java
Last active August 29, 2015 14:13
This TypeAdapterFactory adapts values using Regular Expressions whose at runtime GSON doesn't know about beforehand. See the source code and modify to your will (Apache 2.0 Licensed).
/*
* Copyright 2015 Aldo Borrero <aldo@aldoborrero.com>
* Copyright (C) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@aldoborrero
aldoborrero / SSL_certificate.sh
Created March 24, 2013 01:34
Generate a dummy wildcard SSL certificate.
# Enter a passphrase if you want
openssl genrsa -des3 -out server.key 1024
# Fill data with whatever you want
openssl req -new -key server.key -out server.csr
cp server.key server.key.org
openssl rsa -in server.key.org -out server.key
@aldoborrero
aldoborrero / Configurar_Tiki
Created October 27, 2011 12:14
Configura Tiki automáticamente para el proyecto ALMA
Este profile configura Tikiwiki para trabajar en ALMA.
Crea también los profiles necesarios para crear asignaturas de manera automática.
Se puede ejecutar directamente en Admin > Profiles > Advanced > Profile Tester
Esta sección se encarga de configurar las opciones generales de Tiki. ¡No olvides cambiar el password del correo por el password original!
{CODE(caption="YAML" wrap="1")}
preferences:
language: es
@aldoborrero
aldoborrero / Crear_Asignatura_DC
Created October 27, 2011 09:31
Crea un Workspace de tipo asignatura
{DATACHANNEL(channel=crear_asignatura)}
nombre_asignatura, Nombre asignatura
{DATACHANNEL}