Skip to content

Instantly share code, notes, and snippets.

@tiagoamaro
tiagoamaro / class-list.js
Last active May 30, 2020 20:42
Lógica de Programação 2020 - Exercício 02
const class1 = ['yasmin', 'isadora', 'benedita', 'brenda', 'luiza', 'fatima', 'caio', 'teresinha', 'hugo', 'zeca', 'catarina', 'emanuel', 'marcelo', 'claudio', 'marina', 'isabela', 'anthony', 'rebeca', 'filipe', 'laís', 'vinicius', 'helena', 'elisa', 'rodrigo', 'geraldo', 'yuri', 'marcio']
const class2 = ['benedita', 'elisa', 'emanuel', 'rodrigo', 'filipe', 'marcio', 'teresinha', 'laís', 'vinicius', 'marina', 'catarina', 'luiza', 'marcelo', 'rebeca', 'hugo', 'geraldo', 'zeca', 'caio', 'anthony', 'yasmin', 'claudio']
const class3 = ['isadora', 'isabela', 'laís', 'claudio', 'catarina', 'zeca', 'teresinha', 'emanuel', 'marcio', 'fatima', 'rodrigo', 'luiza', 'brenda', 'marina', 'marcelo', 'benedita', 'rebeca', 'filipe', 'helena', 'elisa', 'hugo', 'geraldo']
@tiagoamaro
tiagoamaro / example-1.js
Last active August 23, 2022 05:58
Lógica de Programação 2020 - Aula 06
function bubbleSort (items) {
const length = items.length
for (let i = (length - 1); i >= 0; i--) {
for (let j = (length - i); j > 0; j--) {
// Compare the adjacent positions
if (items[j] < items[j - 1]) {
// Swap the numbers
const tmp = items[j]
items[j] = items[j - 1]
items[j - 1] = tmp
@tiagoamaro
tiagoamaro / example-1.js
Last active May 23, 2020 20:03
Lógica de Programação 2020 - Aula 05
function sum (a, b) {
return a + b
}
let result = sum(2, 2)
console.log(result)
@tiagoamaro
tiagoamaro / example-1.js
Last active May 21, 2020 19:13
Lógica de Programação 2020 - Aula 04
let cakeIsBaked = false
let totalMinutes = 0
let minutesToBake = 30
while (!cakeIsBaked) {
totalMinutes = totalMinutes + 10 // Wait 10 minutes
if (totalMinutes === minutesToBake) {
cakeIsBaked = true // Exit condition
}
@tiagoamaro
tiagoamaro / README.md
Created May 17, 2020 18:51
Custom Docker address pool (VPN configuration)
@tiagoamaro
tiagoamaro / if-else-chained-1.js
Last active March 9, 2022 18:26
Lógica de Programação 2020 - Aula 03
if (condition) {
// This will execute if condition is true
} else if (anotherCondition) {
// This will only be executed if condition is false
// and another condition is true
}
@tiagoamaro
tiagoamaro / carbon-config.json
Created May 10, 2020 13:28
Toti's Carbon.now.sh configuration (https://carbon.now.sh)
{"paddingVertical":"24px","paddingHorizontal":"23px","backgroundImage":null,"backgroundImageSelection":null,"backgroundMode":"color","backgroundColor":"rgba(255,255,255,1)","dropShadow":false,"dropShadowOffsetY":"20px","dropShadowBlurRadius":"68px","theme":"vscode","windowTheme":"none","language":"javascript","fontFamily":"Hack","fontSize":"14px","lineHeight":"133%","windowControls":false,"widthAdjustment":true,"lineNumbers":false,"firstLineNumber":1,"exportSize":"2x","watermark":false,"squaredImage":false,"hiddenCharacters":false,"name":"","id":"bc79fdd0bea144cf1b85dc061afd9b86","gist_id":"bc79fdd0bea144cf1b85dc061afd9b86","loading":false,"isVisible":true}
@tiagoamaro
tiagoamaro / mock_statsd.py
Last active March 20, 2025 17:57
Statsd to STDOUT (Ruby and Python)
# -*- coding: utf-8 -*-
# Source: https://gist.github.com/wilspi/f68545494eafd57b7a8229ba3359c389
# Script to run UDP Server on 127.0.0.1:8126
# This mocks statsd server for testing
import socket
UDP_IP_ADDRESS = "127.0.0.1"
UDP_PORT_NO = 8126
@tiagoamaro
tiagoamaro / step-by-step.md
Last active April 12, 2020 17:28
Using rclone with OneDrive
@tiagoamaro
tiagoamaro / adding-to-systemctl.sh
Last active April 12, 2020 12:25
abraunegg/onedrive instructions
systemctl --user enable onedrive
systemctl --user start onedrive
# To see the logs run:
journalctl --user-unit onedrive -f
# Check its status
systemctl --user status onedrive