Skip to content

Instantly share code, notes, and snippets.

View sebagomez's full-sized avatar
:octocat:
World's okayest tech lead

Sebastián Gómez sebagomez

:octocat:
World's okayest tech lead
View GitHub Profile
@sebagomez
sebagomez / gx-k8s-app.prod.yaml
Created March 2, 2020 20:44
Kubernetes GeneXus Java app with Redis
apiVersion: v1
kind: Service
metadata:
name: gx-java-app
labels:
app: gx-java-app
spec:
ports:
- port: 8080
selector:
# from https://gist.github.com/jchandra74/5b0c94385175c7a8d1cb39bc5157365e
function ccode { Set-Location c:\code }
# Helper function to set location to the User Profile directory
function cuserprofile { Set-Location ~ }
Set-Alias ~ cuserprofile -Option AllScope
# Ensure posh-git is loaded
Import-Module -Name posh-git
@sebagomez
sebagomez / FlightNumParse.cs
Last active May 5, 2019 16:11
Flight number parser
public static (string airline, string number) Parse(string flightNumber)
{
string airline = "", number = "";
flightNumber = flightNumber.Trim().Replace(" ", "");
for (int i = 0; i < flightNumber.Length; i++)
{
char c = flightNumber[i];
if (c > 64 && string.IsNullOrEmpty(number))
airline += c;
@sebagomez
sebagomez / clean_kb.ps1
Last active March 13, 2019 14:15
Remove a Knwoledge Base (or many) with this PowerShell scipt
param(
[Parameter(Mandatory = $true)]
[string]$folder,
[Parameter(Mandatory = $false)]
[switch]$batch,
[Parameter(Mandatory = $false)]
[string]$sqlInstance=".\SQL2016"
@sebagomez
sebagomez / enable_https.ps1
Created February 1, 2019 15:23
Enable https via PowerShell
$cert = (New-SelfSignedCertificate -DnsName localhost -CertStoreLocation cert:Localmachine\My).Thumbprint
New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https
Get-Item cert:\LocalMachine\MY\$cert | New-Item IIS:\SslBindings\0.0.0.0!443
@sebagomez
sebagomez / GeneXusM.dockerfile
Last active February 8, 2019 15:43
Windows Container dockerfile
# escape=`
FROM microsoft/dotnet-framework:4.7.2-runtime
LABEL MAINTAINER="Seba Gómez <sgomez@genexus.com>"
# GeneXus
COPY GeneXus/ c:/GeneXus
RUN C:/GeneXus/Genexus.com /install && `
powershell -Command "Copy-Item C:/Users/ContainerAdministrator/AppData/Roaming/GeneXus C:/Windows/SysWOW64/config/systemprofile/AppData/Roaming -Recurse"
@sebagomez
sebagomez / cleanup.bat
Created January 30, 2019 15:05
Remove danlging (<none>) docker images in Windows
powershell -Command "docker rmi $(docker images -q -f dangling=true)"
@sebagomez
sebagomez / sqlserver.bat
Created March 14, 2018 19:50
Start SQL Server 2017 Docker instance
docker run --rm -p 1533:1433 -e ACCEPT_EULA=Y -e MSSQL_SA_PASSWORD=dbPassword! -e MSSQL_PID=Developer -d --name sqlserver microsoft/mssql-server-linux:2017-GA
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install 7zip /y
choco install docker-for-windows /y
choco install dotpeek /y
choco install git /y
choco install git-desktop /y
choco install googlechrome /y
choco install brave /y
choco install mousewithoutborders /y
@sebagomez
sebagomez / BinarySearch.cs
Last active February 13, 2017 18:00
C# Binary Search implementation
const int NOT_FOUND = -1;
static int Find(int[] arr, int num)
{
if (arr.Length == 0)
return NOT_FOUND;
if (arr.Length == 1)
return arr[0] == num ? 0 : NOT_FOUND;
int m = arr.Length / 2;