Skip to content

Instantly share code, notes, and snippets.

View DanyelMorales's full-sized avatar
🦆
#stayHome

Daniel V Morales DanyelMorales

🦆
#stayHome
  • Software Engineer
  • San Antonio, Texas
View GitHub Profile
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import display, clear_output
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
for i in range(20):
x = np.arange(0, i, 0.1);
@DanyelMorales
DanyelMorales / healthCheck.go
Created January 24, 2022 06:27
Heartbeat healthcheck
func health() {
dowork := func(done <-chan interface{}, pulseInterval time.Duration) (<-chan interface{}, <-chan time.Time) {
hearthbeat := make(chan interface{})
results := make(chan time.Time)
go func() {
defer close(hearthbeat)
defer close(results)
pulse := time.Tick(pulseInterval)
workGen := time.Tick(2 * pulseInterval)
@DanyelMorales
DanyelMorales / add_intellij_launcer
Created September 20, 2021 06:58 — forked from rob-murray/add_intellij_launcer
Add Intellij launcher shortcut and icon for ubuntu
// create file:
sudo vim /usr/share/applications/intellij.desktop
// add the following
[Desktop Entry]
Version=13.0
Type=Application
Terminal=false
Icon[en_US]=/home/rob/.intellij-13/bin/idea.png
Name[en_US]=IntelliJ
@DanyelMorales
DanyelMorales / or.go
Created August 11, 2021 20:26
OR CHANNELS
package main
import (
"fmt"
"time"
)
func main() {
var or func(channels ...<-chan interface{}) <-chan interface{}
or = func(channels ...<-chan interface{}) <-chan interface{} {
@DanyelMorales
DanyelMorales / phpArraySerialization.pl
Last active March 30, 2021 23:26
Serialize a perl array into a php array
#!/usr/bin/perl
use strict;
use warnings;
sub serializeToPhpArray {
my @arr = @{$_[0]};
my $content = "a:".@arr.":{";
for (my $i=0; $i < @arr; $i++) {
my $val = $arr[$i];
import java.util.Scanner;
public class PascalTriangle
{
public static void main(String a[]) throws Exception
{
int num=0;
Scanner scan=new Scanner(System.in);
System.out.println("Enter number of rows for pascal triangle:");
@DanyelMorales
DanyelMorales / ContainsSameLetters.java
Created June 16, 2020 22:14
Different approaches to detect repeated letters
package com.company;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@DanyelMorales
DanyelMorales / findElements.js
Created December 12, 2018 15:42
find Elements start with @
Parser.prototype.findElements = function(block, filename) {
var elements = [];
// Replace Linebreak with Unicode
block = block.replace(/\n/g, '\uffff');
// Elements start with @
var elementsRegExp = /(@(\w*)\s?(.+?)(?=\uffff[\s\*]*@|$))/gm;
var matches = elementsRegExp.exec(block);
@DanyelMorales
DanyelMorales / replace.js
Created December 12, 2018 15:35
Replace Linebreak with Unicode
// Replace Linebreak with Unicode
block = block.replace(/\n/g, '\uffff');
@DanyelMorales
DanyelMorales / reverse.js
Created December 12, 2018 15:33
Reverse Unicode Linebreaks
// Reverse Unicode Linebreaks
block = block.replace(/\uffff/g, '\n');