Skip to content

Instantly share code, notes, and snippets.

View Wilo's full-sized avatar
🍻
Prost!

William Méndez Wilo

🍻
Prost!
View GitHub Profile
package main
import "fmt"
func GetCount(str string) (count int) {
for _, value := range str {
switch value {
case 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U':
count++
}
/*
The goal of this exercise is to convert a string to a new string where each character in the new string
is "(" if that character appears only once in the original string, or ")" if that character appears more
than once in the original string. Ignore capitalization when determining if a character is a duplicate.
Examples:
"din" => "((("
"recede" => "()()()"
"Success" => ")())())"
"(( @" => "))(("
@Wilo
Wilo / hungarian_vowel_harmony.js
Created September 27, 2020 16:26
Implementación del dativo en el idioma húngaro
const dative = (word) => {
return word.match(/[aáoóuú]+/gi) ? `${word}nak` : `${word}nek`;
}
console.log(dative("ablak"))
/*
https://en.wikipedia.org/wiki/Vowel_harmony#Hungarian
Input Expected
@Wilo
Wilo / phonenumber.js
Created September 27, 2020 05:12
Create Phone Number
function createPhoneNumber(numbers){
return `(${numbers.slice(0,3).join("")}) ${numbers.slice(3,6).join("")}-${numbers.slice(6,10).join("")}`
}
console.log(createPhoneNumber([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]))
// "(123) 456-7890"
@Wilo
Wilo / morsedecoder.js
Last active September 27, 2020 14:09
Morse Decoder
const decodeMorse = (morseCode) => {
let splitted = morseCode.split(" ")
let str = []
const Codes = {
".-": "A", "-...": "B", "-.-.": "C", "-..": "D",
".": "E", "..-.": "F", "--.": "G", "....": "H",
"..": "I", ".---": "J", "-.-": "K", ".-..": "L",
"--": "M", "-.": "N", "---": "O", ".--.": "P",
"--.-": "Q", ".-.": "R", "...": "S", "-": "T",
"..-": "U", "...-": "V", ".--": "W", "-..-": "X",
@Wilo
Wilo / Dockerfile
Created September 15, 2020 13:44
multistage dockerfile
# ------------------------------------------------------------------------------
# GOLANG Build Stage
# ------------------------------------------------------------------------------
FROM golang:alpine as builder
RUN apk add bash git gcc g++ libc-dev
RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates
WORKDIR /usr/src/microservice_intranet_solicitudes
@Wilo
Wilo / user_password_django_pbkdf2_sha256.go
Created August 20, 2020 12:20 — forked from mununki/user_password_django_pbkdf2_sha256.go
[Go] Implementation Django default password hashing PBKDF2_SHA256 with Go
import (
"crypto/rand"
"crypto/sha256"
"crypto/subtle"
"encoding/base64"
"strconv"
"strings"
"time"
"golang.org/x/crypto/pbkdf2"
[
{
"title": "Home",
"route": "/"
},
{
"title": "Product",
"route": "/product/"
},
{
@Wilo
Wilo / views.py
Created January 23, 2020 08:01
QR Code Generator on View
#QR Code Generator
from django.http import HttpResponse
import base64
import pyqrcode
def qr_code_generator(request):
key = request.GET.get('key', None)
if key:
qrcode = pyqrcode.create(key)
base64image = qrcode.png_as_base64_str(scale=6)
binaryfile = base64.b64decode(base64image)
@Wilo
Wilo / list-constraints.sql
Created January 12, 2020 06:48 — forked from PickledDragon/list-constraints.sql
Postgres list all constraints
SELECT
tc.constraint_name, tc.table_name, kcu.column_name,
ccu.table_name AS foreign_table_name,
ccu.column_name AS foreign_column_name
FROM
information_schema.table_constraints AS tc
JOIN information_schema.key_column_usage AS kcu
ON tc.constraint_name = kcu.constraint_name
JOIN information_schema.constraint_column_usage AS ccu
ON ccu.constraint_name = tc.constraint_name