Skip to content

Instantly share code, notes, and snippets.

@grze2000
grze2000 / gamepad.ino
Created January 26, 2021 12:51
Arduino Gamepad
#include <Joystick.h>
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_JOYSTICK, 12);
const int pins[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 14, 15, 16};
const int btnNr[12] = {2, 0, 7, 4, 5, 6, 8, 9, 1, 10, 11, 3}; // depends on order in which the buttons are connected to Arduino
void setup() {
for(int i=0; i<sizeof(pins)/sizeof(pins[0]); i++) {
pinMode(pins[i], INPUT_PULLUP);
@grze2000
grze2000 / index.html
Created December 3, 2020 20:43
Funkcje matematyczne w JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JS</title>
</head>
<body>
<script>
document.write('3<br>');
@grze2000
grze2000 / main.py
Last active May 25, 2020 11:55
Matura Informatyka 2019 zadanie 6
import re
def readFile(path):
with open(path) as file:
return list(map(lambda x: x.strip().split('\t'), file.readlines()))[1:]
marki = readFile('marki.txt')
perfumy = readFile('perfumy.txt')
sklad = readFile('sklad.txt')
@grze2000
grze2000 / silnia.py
Created October 28, 2018 18:24
Calculating the factorial value of a given number
from decimal import *
import sys
setcontext(Context(prec=3,capitals=0))
inputValue = input("Enter n: ") # Enter the value of n
try:
integer = int(inputValue) # Convert a string to an integer
if(integer >= 0): # If the integer is non-negative
factorialValue = Decimal(1) # Set the initial value
for i in range(1,integer+1): # For every positive integer less than n
factorialValue *= i # Multiple the value by the integer