Skip to content

Instantly share code, notes, and snippets.

View diogomartino's full-sized avatar
🏠
Working from home

Diogo Martino diogomartino

🏠
Working from home
View GitHub Profile
@diogomartino
diogomartino / set-default-device.ps1
Last active June 17, 2023 12:33
Set default audio device powershell script
# This script is for Steelseries headphones users, but you can change it to meet your goal
# Before running this you need to install the required module
# Run this in powershell as administrator:
# Install-Module -Name AudioDeviceCmdlets
# Check if module is installed
$moduleName = "AudioDeviceCmdlets"
$moduleInstalled = Get-Module -ListAvailable | Where-Object {$_.Name -eq $moduleName}
@diogomartino
diogomartino / README.md
Last active November 24, 2019 01:31
How to connect ESP8266-01 to Arduino

Program the ESP8266-01

1: Buy a USB programmer. There are other ways, but this is the easiest. They cost like 1$. Example

2: You need to make a change to your USB Programmer if you want to push code to it. You will need to short these pins when you upload your code into it:

Pins

I recommend you to solder some kind of switch to it, to be able to switch between "code mode" and "debug mode". The debug mode will allow you to use the Serial Mode. The code mode will allow you to push code to the microcontroller and to do that those pins need to be shorted. My solution:

@diogomartino
diogomartino / steambgpreviewer.js
Last active August 19, 2019 22:08
Steam Background Previewer tampermonkey script
// ==UserScript==
// @name Steam Background Previewer
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Preview steam backgrounds on your profile
// @author Diogo Martino
// @include /(?:https?:\/\/)?steamcommunity\.com\/(?:profiles|id)\/[a-zA-Z0-9]+/
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js
def main():
cartao = input("Introduza o número do cartão\n")
print("Cartão inválido") if validateCC(cartao) == 0 else print("Cartão válido")
def getNumberFromChar(letra):
charDict = {
"0" : "0",
"1" : "1",
"2" : "2",
"3" : "3",
@diogomartino
diogomartino / caesarcipher.py
Last active May 21, 2018 17:50
Caesar Cipher Python (Cifra de César)
lista = [" ", "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","x","y","w","z"]
def encode(text, offset):
encodedText = ""
for i in range(len(text)):
letterIndex = -1
for a in range(len(lista)):
if lista[a] == text[i]:
letterIndex = a
if letterIndex + offset > len(lista) + 1: