Skip to content

Instantly share code, notes, and snippets.

View miguelangelgonzalez's full-sized avatar

Miguel Angel Gonzalez miguelangelgonzalez

View GitHub Profile
@miguelangelgonzalez
miguelangelgonzalez / fetch_rubymine_license.rb
Created October 24, 2019 13:59 — forked from avsej/fetch_rubymine_license.rb
Automate rubymine license fetching
#!/usr/bin/env ruby
require 'rubygems'
require 'net/http'
require 'digest/md5'
require 'pp'
begin
require 'faker'
rescue LoadError
puts "You should install faker gem. (gem install faker)"
exit
@miguelangelgonzalez
miguelangelgonzalez / merge_intervals.py
Created February 20, 2019 12:43
Given a collection of intervals, merge all overlapping intervals.
# https://statyang.wordpress.com/python-practice-101-merge-intervals/
# Definition for an interval.
class Interval:
def __init__(self, s=0, e=0):
self.start = s
self.end = e
class Solution:
# @param {Interval[]} intervals
# @return {Interval[]}
@miguelangelgonzalez
miguelangelgonzalez / dollar.sh
Created January 3, 2019 15:53
Get the quote of the dollar in the main Argentine banks
while true;do clear;echo "Cotizacion $(date)";echo -e "Dolar (Santander) : \t" $(curl -Ls "https://bit.ly/2O9Mvvm"|grep '[0-9]{2},[0-9]{2}' -Eo|head -n2);echo -e "Dolar (Nacion) : \t" $(curl -Ls "https://bit.ly/2NvKhcM"|tr -d ' '|grep DolarU\.S\.A -A2|grep -oE '[0-9]{2},[0-9]{2}'|tr '\n' ' ');echo -e "Dolar (Galicia) : \t" $(curl -Ls "https://bit.ly/2wWvApx"|jq -r '.buy + "0", .sell + "0"'|tr '\n' ' ');echo -e "Dolar (BBVA-Frances) : \t" $(curl -Ls "https://bit.ly/2O0wxUt"|iconv -f iso-8859-1 -t utf-8|sed -n "s,detalles,\n,gp"|grep -oE '[0-9]{2},[0-9]{2}'|head -n2|tr '\n' ' ');sleep 600;done
@miguelangelgonzalez
miguelangelgonzalez / push-to-ios.cs
Created January 11, 2018 18:11
Example of push shrap sending an alert to IOS
using System;
using Newtonsoft.Json.Linq;
using PushSharp.Apple;
namespace DeploymentUnit
{
class Program
{
static void Main(string[] args)
{
@miguelangelgonzalez
miguelangelgonzalez / Docker-for-windows-know-issue-hns-error.md
Last active December 26, 2017 17:59
Docker on windows server 2016. HNS failed with error : Element not found.

Stop the docker service (PS C:> stop-service docker)

Stop the HNS service (PS C:> stop-service hns)

In regedit, delete all of the registry keys under these paths: HKLM:\SYSTEM\CurrentControlSet\Services\vmsmp\parameters\SwitchList HKLM:\SYSTEM\CurrentControlSet\Services\vmsmp\parameters\NicList

Run get-containernetwork | remove-containernetwork

version: '3.1'
services:
db:
image: microsoft/nanoserver
command: powershell /c sleep 3600
web:
image: microsoft/nanoserver
command: ping db
depends_on:
@miguelangelgonzalez
miguelangelgonzalez / docker-commands.md
Last active November 29, 2017 12:56
Favorites dockers command

Delete all containers

docker rm -f $(docker ps -a -q)

Delete all images

docker rmi -f $(docker images -q)
heartbeat.monitors:
- type: http
schedule: '@every 30s'
urls: ["https://procyon.leapcentral.net/subscriberbc", "https://procyon.leapcentral.net/stsbc", "https://procyon.leapcentral.net/messagingbc", "https://procyon.leapcentral.net/pushbc", "https://procyon.leapcentral.net/analyticsbc"]
check.request.method: HEAD
check.response.status: 200
- type: icmp
schedule: '@every 30s'
hosts:
@miguelangelgonzalez
miguelangelgonzalez / PredicatableGuid.cs
Created May 30, 2017 15:50 — forked from ChrisMcKee/PredicatableGuid.cs
Namespaced Deterministic Guid - RFC 4122 dotnetcore
using System;
using System.Security.Cryptography;
using System.Text;
namespace Utility
{
/// <summary>
/// Helper methods for working with <see cref="Guid"/>.
/// </summary>
public static class GuidUtility
docker-machine env node-1 | Invoke-Expression
docker run -d --name portainer -p 9000:9000 -v "/var/run/docker.sock:/var/run/docker.sock" portainer/portainer
docker network create --driver overlay elk
docker network create --driver overlay proxy
docker service create --name util --network elk --mode global alpine sleep 1000000000
docker service create --name escluster --mount type=bind,source=/tmp,target=/data --mode global --constraint 'node.role==worker' --network elk --endpoint-mode dnsrr -e ES_JAVA_OPTS="-Xms512m -Xmx512m" elasticsearch:5.3.0 -E cluster.name=home -E network.host=0.0.0.0 -E discovery.zen.ping.unicast.hosts=escluster -E discovery.zen.minimum_master_nodes=1