Skip to content

Instantly share code, notes, and snippets.

View juanmf's full-sized avatar
💭
I may be slow to respond.

Juan Manuel Fernandez juanmf

💭
I may be slow to respond.
View GitHub Profile
@juanmf
juanmf / waveForm.py
Last active October 21, 2023 01:07
Writes a CSV waveform.csv to local dir meant to import in a function generator. Merging specified frequencies. See https://gist.github.com/juanmf/2fd9ae5a6f7a6bfe851c6c699b98e8d1 for output sample. use Junctek windows app to upload to device http://www.junteks.com/newsinfo/835494.html
##
# Writes a CSV waveform.csv to local dir meant to import in a function generator.
# The wave is meant to be input in a highside bridge switching a coil to create a BEMF
# on every LOW (0).
# It merges several frequencies together by adding a LOW (trigger BEMF impulse) at the start of every
# cycle of included frequencies. Very much like swing seats you push only at the beggining of each cycle,
# each with a different period.
# Selected Frequencies are in line with the equation (Planck * ϕ ^ N)
##
##
@juanmf
juanmf / gist:9767d7bf7e3d56be8a8ec91ad3c3328b
Last active February 9, 2022 21:02
Horse problem solved with my niece.
import java.util.Arrays;
/**
* Horse problem solved with my niece.
*/
public class Caballo {
private static byte[][] tablero = new byte[][]
{{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0},
@juanmf
juanmf / gist:87f71cfc3c7c00471eafcf318485e314
Last active September 21, 2019 00:06
context switching tests.
import lombok.AllArgsConstructor;
import org.junit.Test;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@juanmf
juanmf / Stopwatch.java
Last active March 24, 2019 16:28
Simple Stopwatch that keeps a cache of running tasks.
import java.util.Collections;
import java.util.Map;
import java.util.TreeMap;
/**
* Usage:
*
* Stopwatch.start("watchName");
* ...
package com.mycompany;
/**
* Created by juanmf on 15/07/17.
*/
import java.util.Arrays;
import java.util.stream.Collectors;
import org.apache.spark.api.java.*;
import org.apache.spark.SparkConf;
@juanmf
juanmf / daily-exchange.js
Created March 4, 2017 07:40
Webtask.io little hack
/**
* This script can be automatically triggered with IFTTT Stocks trigger and should
* be called with the following query string params:
*
* inputCurrency={{InputCurrency}}
* outputCurrency={{OutputCurrency}}
* exchangeRate={{ExchangeRate}}
* infoUrl={{InfoUrl}}
* checkTime={{CheckTime}}
*
@juanmf
juanmf / MutableBigInteger.java
Last active March 24, 2016 12:58
MutableBigInteger
/*
* The MIT License
*
* Copyright 2016 juan.fernandez.
*
* 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
#The Config File
# The tool: https://github.com/juanmf/RedmineIssueImporter
#Use the following config file format to import sheets into redmine. So far it creates Issues,
#with custom fields, but it's extensible to add users, etc..
################################################################################
# Run customization
<?php
namespace Application\ProcessBundle\Subscriber;
//Since Doctrine 2.4
//use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
//use Doctrine\Common\Persistence\Event\PreUpdateEventArgs;
use Symfony\Bridge\Monolog\Logger as SfLogger;
use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
/**
* Recursive Prototype Clonner:
* it relies on the following data structure:
* <someAncestor data-allow-add="true"> ...
* <button class="" data-add="add"
* data-add-prototype-node="JQ selector relative to $button.closest('[data-allow-add]'). Will be parameter of $obj.find($selector)"
* data-add-prototype-name="<?php echo $prototypeName; ?> optional, defauts to __name__"
* data-add-append-node="%data-add-prototype-node% | JQ selector relative to $button.closest('[data-allow-add]').
* Will be parameter of $obj.find($selector)"
* data-add-wrapper="html to wrap the cloned item before appending e.g. <li>__PROTOTYPE-CONTENT__</li>"