Skip to content

Instantly share code, notes, and snippets.

@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 May 5, 2020 13:40
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
@tiagoamaro
tiagoamaro / spotify_control
Created August 14, 2019 12:48
Spotify Control (Ubuntu)
#!/usr/bin/env bash
# Simple Spotify Control
# Just call ./spotify_control --help
# Source: https://community.spotify.com/t5/Desktop-Linux/Linux-keyboard-shortcuts/td-p/1626394
CMD="dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player"
case "$1" in
"playpause" )
@tiagoamaro
tiagoamaro / delete-git-status-files.sh
Created March 12, 2019 12:04
Delete all git status files
git status -s | cut -c4- | xargs rm -r