Skip to content

Instantly share code, notes, and snippets.

View eldenis's full-sized avatar

Denis J. González eldenis

View GitHub Profile
@eldenis
eldenis / get_ip.bat
Created February 6, 2019 15:29
Get current IP addresses in Windows
@echo off
set ip_address_string="IPv4"
for /f "usebackq tokens=2 delims=:" %%f in (`ipconfig ^| findstr /c:%ip_address_string%`) do echo Your IP Address is: %%f
@eldenis
eldenis / GetStringAge.sql
Created September 8, 2018 20:58
MS SQL Server function to get a string in natural language with a person's age (newborns to elderly).
CREATE FUNCTION [dbo].[Getagestring] (@birth_date datetime)
RETURNS varchar(80)
AS
BEGIN
DECLARE @age int
SELECT
@age = DATEDIFF(yy, @birth_date, GETDATE()) - CASE
WHEN
DATEADD(yy, DATEDIFF(yy,
@eldenis
eldenis / intersection.cs
Created March 30, 2018 22:46
Interview question. Intersection between two arrays.
static IEnumerable<int> Intersection(int[] a, int[] b)
{
int i = 0, j = 0;
while (i < a.Length && j < b.Length)
{
if (a[i] < b[j])
{
i++;
continue;
@eldenis
eldenis / EvilestClassEver.cs
Created October 14, 2015 14:59
Evilest C# Class Ever
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using static System.Console;
namespace ConsoleApplication2
{
class Program
{
static string Str => $"This is the time: {DateTime.Now}";
import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here