Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Cristian Benavides Jimenez sairoko12

🎯
Focusing
Block or report user

Report or block sairoko12

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sairoko12
sairoko12 / utils.py
Created Dec 22, 2018
Utils functions for python projects
View utils.py
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
View calculadora.py
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 Nov 6, 2018
Script regenerate aws cli session with MFA virtual device
View example-execute
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 Oct 22, 2018 — forked from ogavrisevs/aws-temp-token.sh
Script to generate AWS STS token
View aws-temp-token.sh
#!/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 Feb 16, 2018
Simple function that create slugs
View slugify.js
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 -
You can’t perform that action at this time.