Skip to content

Instantly share code, notes, and snippets.

View hugmanrique's full-sized avatar

Hugo Manrique hugmanrique

View GitHub Profile
hugmanrique / Splash.qml
Last active January 15, 2023 23:18
Simple KDE Splash screen that displays a background image (ideally the desktop wallpaper)
SPDX-FileCopyrightText: 2014 Marco Martin <>
SPDX-FileCopyrightText: 2023 Hugo Manrique <>
SPDX-License-Identifier: GPL-2.0-or-later
import QtQuick 2.5
import QtQuick.Window 2.2
import org.kde.plasma.core 2.0 as PlasmaCore
hugmanrique / Navbar.js
Last active November 18, 2022 14:40
Next.js Navbar component using the new React Hooks API
import React, { useState, useEffect } from 'react';
import Router from 'next/router';
import Link from 'next/link';
export default function Navbar({ brand, items }) {
const [activeIndex, setActiveIndex] = useState(-1);
() => {
const handleRouteChange = url => {
hugmanrique /
Last active October 22, 2022 02:30
Small ArmorStand animation created with the Bukkit API
public class SwordAnimation {
// Config variables
private static final float SEPARATOR = 2;
private static final float RAD_PER_SEC = 1.5F;
private static final float RAD_PER_TICK = RAD_PER_SEC / 20F;
private Location center;
private double radius;
private List<ArmorStand> swords;
hugmanrique /
Last active September 4, 2022 02:25
How to install and interface with LAPACK from a C++ project


To install BLAS and LAPACK on a Debian-based system, run

$ sudo apt install libblas-dev liblapack-dev

The LAPACKE library provides a C interface to LAPACK, and can be installed using

$ sudo apt install liblapacke-dev
hugmanrique / LICENSE
Last active August 26, 2022 01:55
What's the cardinality of the intersection of the English dictionary and npm package names?
MIT License
Copyright (c) 2022 Hugo Manrique
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
use anyhow::Result;
use bluer::Address;
use std::collections::HashSet;
use std::fs::{File, OpenOptions};
use std::io::{ErrorKind, Read, Write};
use std::ops::Deref;
use std::path::PathBuf;
/// A set of paired device addresses, backed by a file.
pub struct PairedDevices {
hugmanrique / bezier_cubic_splines.m
Created August 28, 2021 21:03
Piecewise cubic Bézier curve interpolation
f = @(x) cos(x);
xa = 0;
xb = 2 * pi;
n = 4; % number of cubic polynomials
x = linspace(xa, xb, n + 1); % x_0, ..., x_n
y = f(x); % y_0, ..., y_n
hugmanrique / findMinimum.js
Last active July 24, 2021 22:05
Multivariate (ℝ^2) relative minimum brute-force finder
// The function we want to find the minimums of
const getValue = (m, n) => m * m + n * n;
// The sampling interval (in ℝ^2)
let mStart = 0;
let nStart = 0;
let mEnd = 1;
let nEnd = 1;
public enum BooleanFieldEnum {
// 2000 enum constants
private final boolean set;
BooleanFieldEnum() {
// Compute value on class loading, doesn't affect benchmark results
this.set = ThreadLocalRandom.current().nextBoolean();