Skip to content

Instantly share code, notes, and snippets.

View sairoko12's full-sized avatar
🤓
Working ...

Cristian Benavides sairoko12

🤓
Working ...
View GitHub Profile
@sairoko12
sairoko12 / aoe2hd.md
Created August 11, 2021 03:35 — forked from yocontra/aoe2hd.md
Age of Empires II HD - For Mac OSX
@sairoko12
sairoko12 / utils.py
Created December 22, 2018 05:06
Utils functions for python projects
def dict_to_list(dictionary):
return [
[
key,
dict_to_list(value) if isinstance(value, (dict)) else value
] for key, value in dictionary.items()
]
def first_value_of_matrix(matrix):
value = None
import re
class Operaciones():
def __init__(self, operation):
self.operaciones_disponibles = {
"+": self.suma,
"-": self.resta,
"/": self.division,
"*": self.multiplicacion
}
@sairoko12
sairoko12 / example-execute
Last active November 6, 2018 16:31
Script regenerate aws cli session with MFA virtual device
sh regenerate-aws-session.sh 123456 # <- This is my mfa token
# Or
regenerate-aws-session 123456 # <- This is my mfa token
# Done 🎊
@sairoko12
sairoko12 / aws-temp-token.sh
Created October 22, 2018 15:20 — forked from ogavrisevs/aws-temp-token.sh
Script to generate AWS STS token
#!/bin/bash
#
# Sample for getting temp session token from AWS STS
#
# aws --profile youriamuser sts get-session-token --duration 3600 \
# --serial-number arn:aws:iam::012345678901:mfa/user --token-code 012345
#
# Based on : https://github.com/EvidentSecurity/MFAonCLI/blob/master/aws-temp-token.sh
#
@sairoko12
sairoko12 / slugify.js
Created February 16, 2018 23:10
Simple function that create slugs
const slugify = text => {
// Use hash map for special characters
let specialChars = {"à":'a',"ä":'a',"á":'a',"â":'a',"æ":'a',"å":'a',"ë":'e',"è":'e',"é":'e', "ê":'e',"î":'i',"ï":'i',"ì":'i',"í":'i',"ò":'o',"ó":'o',"ö":'o',"ô":'o',"ø":'o',"ù":'o',"ú":'u',"ü":'u',"û":'u',"ñ":'n',"ç":'c',"ß":'s',"ÿ":'y',"œ":'o',"ŕ":'r',"ś":'s',"ń":'n',"ṕ":'p',"ẃ":'w',"ǵ":'g',"ǹ":'n',"ḿ":'m',"ǘ":'u',"ẍ":'x',"ź":'z',"ḧ":'h',"·":'-',"/":'-',"_":'-',",":'-',":":'-',";":'-'};
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/./g,(target, index, str) => specialChars[target] || target) // Replace special characters using the hash map
.replace(/&/g, '-and-') // Replace & with 'and'
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -