Skip to content

Instantly share code, notes, and snippets.

/*
* This file was written by Aldo Fregoso, and is placed in the public domain.
* The author hereby disclaims copyright to this source code.
*/
#ifndef UTIL_BITFIELD_H
#define UTIL_BITFIELD_H
#include <inttypes.h>
@AldoMX
AldoMX / Steps.cpp
Last active March 10, 2017 07:20
Steps::PredictMeter()
float Steps::PredictMeter() const
{
// Aldo_MX: I'm calculating the meter taking into account the step density.
// It will just give a "base value", you need to increase the value if you
// use pivots and/or it's a gimmicky chart.
//
// In other words, this value should be considered the "minimum possible"
// meter value using 1 ~ 10 difficulty scale.
//
// The following formula is used ONLY with checkpoint combinations possible
/*export default*/ module.exports = (callbacks, timeout = 0) => {
callbacks = callbacks.reverse();
return new Promise((resolve, reject) => {
const values = [];
const errors = [];
let hasError = false;
(function nextPromise() {
let currentCallback = callbacks.pop();
if (currentCallback) {
currentCallback()
@AldoMX
AldoMX / _amx-wsl-startup.sh
Last active November 26, 2017 17:43
Start services during WSL startup
#!/bin/sh
sudo service atd start
sudo service cron start
sudo service dbus start
sudo service irqbalance start
sudo service lvm2-lvmetad start
sudo service lvm2-lvmpolld start
sudo service mdadm start
sudo service ondemand start
sudo service rc.local start
@AldoMX
AldoMX / rocksdb.js
Created November 11, 2018 12:52
ES2018 wrapper for `rocksdb`, works without Babel with Node.js v10 and upwards
const rocksdb = require('rocksdb');
const valueCallback = resolve => (err, value) => err ? Promise.reject(err) : resolve(value);
class RocksDBIterator {
constructor(iterator) {
this.iterator = iterator;
}
async end() {
@AldoMX
AldoMX / local.user-key-mapping.plist
Created October 12, 2019 18:52
Changes the mapping between “§” and “`” keys when using US distribution with non-US keyboards. Download it to `/Library/LaunchDaemons/local.user-key-mapping.plist` and launch it with `launchctl load -w /Library/LaunchDaemons/local.user-key-mapping.plist`.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>local.user-key-mapping</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
@AldoMX
AldoMX / RageSoundReader_FFMpeg.cpp
Last active July 11, 2020 14:00
RageSoundReader_FFMpeg - Sound reader for any format supported by FFMpeg, written for StepMania 3.9, tested with FFMpeg 2.1.4, LGPLv2.1
#include "global.h"
#include "RageFile.h"
#include "RageLog.h"
#include "RageSoundManager.h"
#include "RageUtil.h"
#include "RageSoundReader_FFMpeg.h"
namespace avcodec
@AldoMX
AldoMX / banamex_msi.js
Created May 18, 2021 14:04
Copia MSI de los Smart Statement de Banamex.
setTimeout(
() =>
navigator.clipboard.writeText(
[...document.getElementById("tablaMovimientos").rows]
.filter(({ id, children: [, { innerText: description }] }) => id.startsWith("idexpand") && /\d{3}\s\d{3}\s*$/.test(description))
.map(({ children: [, { innerText: description }, { innerText: amount }] }) => [description, amount].join("\t"))
.join("\n")
),
1000
);
@AldoMX
AldoMX / DisplayProductID-db7
Last active June 6, 2021 20:56
Sceptre C35 Override
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayProductName</key>
<string>Sceptre C355W-3440UN</string>
<key>DisplayProductID</key>
<integer>3511</integer>
<key>DisplayVendorID</key>
<integer>19988</integer>
@AldoMX
AldoMX / PersonaFisica.js
Last active November 2, 2021 20:21
Implementación en JavaScript del algoritmo para generar el RFC para personas físicas (IFAI 0610100135506)
/**
* PersonaFisica.js
*
* Implementación en JavaScript del algoritmo para generar el RFC para personas
* físicas (IFAI 0610100135506)
*
* Copyright 2015 Aldo Fregoso.
*
* El uso de este archivo está permitido bajo los términos de la licencia de
* código abierto "GNU Affero General Public License" (AGPL) disponible en: