Skip to content

Instantly share code, notes, and snippets.

View rodpoblete's full-sized avatar
🎯
Focusing

Rodrigo Poblete rodpoblete

🎯
Focusing
View GitHub Profile
@rodpoblete
rodpoblete / actualizar-script.sh
Created April 14, 2021 03:25
Iniciar servicio Crontab
#1. Crear script Sh en alguna ruta del sistema
#!/bin/bash
sudo apt update && sudo apt upgrade -y
echo "Actulizados los repositorios y paquetes del sistema"
exit
# 2. Darle permisos de ejecución al script (en la ruta que lo hayamos creado)
sudo chmod +x /root/actualizar-script.sh
@rodpoblete
rodpoblete / actualizar.sh
Last active April 13, 2021 02:13
Actulizar repo y paquetes Debian && agregarlo como servicio con systemd
#1. Crear el script actualizar.sh
#!/bin/bash
sudo apt update && sudo apt upgrade -y
#2. Copiamos el script a una ubicación concreta. Para este caso /usr/local/bin
sudo cp actualizar.sh /usr/local/bin
#3. Le damos permisos de ejecución
sudo chmod +x /usr/local/bin/actualizar.sh
@rodpoblete
rodpoblete / settings.json
Created March 28, 2021 00:57
Visual Studio Code Settings Ubuntu
{
"workbench.activityBar.visible": true,
"editor.fontFamily": "Jetbrains Mono",
"editor.fontLigatures": true,
"editor.lineHeight": 23,
"workbench.editor.tabSizing": "shrink",
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.cursorWidth": 5,
"editor.cursorStyle": "line",
@rodpoblete
rodpoblete / cloudSettings
Last active February 18, 2021 19:41
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-02-18T19:41:27.202Z","extensionVersion":"v3.4.3"}
@rodpoblete
rodpoblete / README.md
Created July 25, 2020 16:14 — forked from hasanbayatme/README.md
Easy to use Bash Script to Install LAMP stack on Ubuntu.

Installation

Automatic

Run the below command in terminal:

wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/install-lamp.sh | bash
@rodpoblete
rodpoblete / strip_vowel.py
Created September 27, 2019 02:47
Tome el bloque de texto proporcionado y strip el espacio en blanco en ambos extremos. Dividir el texto por nueva línea (\n). Recorre las líneas, para cada línea: quite los espacios iniciales, compruebe si el primer carácter está en minúsculas, si e
text = """
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
@rodpoblete
rodpoblete / slice_dice.py
Last active September 24, 2019 02:03
Take the block of text provided and `strip` off the whitespace at both ends. Split the text by newline `(\n)`. Loop through the lines, for each line: - strip off any leading spaces, - check if the first character is lowercase, - if so, split the li
from string import ascii_lowercase
text = """
One really nice feature of Python is polymorphism: using the same operation
on different types of objects.
Let's talk about an elegant feature: slicing.
You can use this on a string as well as a list for example
'pybites'[0:2] gives 'py'.
The first value is inclusive and the last one is exclusive so
here we grab indexes 0 and 1, the letter p and y.
@rodpoblete
rodpoblete / persistence.py
Created September 19, 2019 02:31
Se le pasa a la función un numero entero `n` y se debe calcular su *persistencia multiplicativa*. Si el número tiene un solo dígito deberá devolver `0`
def persistence(n):
from functools import reduce # Es necesario importar esta libreria del sistema
l = [int(x) for x in str(n)]
if len(l) == 1:
return(0)
else:
count = 0
while True:
l2 = reduce(lambda x, y: x * y, l)
@rodpoblete
rodpoblete / cual_numero.py
Created September 19, 2019 01:27
Problema IQTest de codewars. Se entrega una serie de números en formato de cadena de texto, y de debe encontrar cuál difiere de los demás. (números pares e impares)
def iq_test(numbers):
l = numbers.split(' ')
l2 = [int(n) for n in l]
odd_list = [l2.index(n) for n in l2 if n % 2 != 0]
even_list = [l2.index(x) for x in l2 if x % 2 == 0]
if len(odd_list) == 1:
odd_index = odd_list[0] + 1
return odd_index
else:
even_index = even_list[0] + 1
@rodpoblete
rodpoblete / findTheCapitals.js
Created December 1, 2017 02:58
Write a function that takes a single string (word) as argument. The function must return an ordered list containing the indexes of all capital letters in the string.
// Instructions
// Write a function that takes a single string (word) as argument. The function must return an ordered list containing the indexes of all capital letters in the string.
// Test.assertSimilar( capitals('CodEWaRs'), [0,3,4,6] );
const capital = function(word) {
const arr = word.split("");
const arrOrdened = arr.map(function(e, i, a) {
if (e === e.toUpperCase()) {