Skip to content

Instantly share code, notes, and snippets.

View hamzamuric's full-sized avatar
📚
Studying

Hamza Muric hamzamuric

📚
Studying
View GitHub Profile
@hamzamuric
hamzamuric / geometrija.c
Created January 24, 2018 00:07
Program za racunanje obima i povrsine osnovnih geometrijskih oblika
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <stdbool.h>
#define PI 3.141592653589793
void clear(){
#if defined(__linux__) || defined(__unix__) || defined(__APPLE__)
system("clear");
#endif
@hamzamuric
hamzamuric / avion.c
Created March 28, 2018 20:43
Zadatak sa prvog kolokviuma iz programiranja (C).
#include <stdio.h>
int main() {
int x, y, z, q, pom;
printf("Unesite vreme uzletanja aviona:\n");
scanf("%d %d %d", &x, &y, &z);
printf("Koliko je sekundi avion proveo u letu?\n");
scanf("%d", &q);
z += q;
from numpy import exp, array, random, dot
class NeuralNetwork:
def __init__(self):
random.seed(1)
self.weights = 2 * random.random((3, 1)) - 1
def __sigmoid(self, x):
return 1 / (1 + exp(-x))
@hamzamuric
hamzamuric / postfix_converter.py
Last active April 14, 2018 22:42
Program to convert mathematical expressions into postfix notation
operators = {'(': 0, ')': 0, '+': 1, '-': 1, '*': 2, '/': 2, '%': 2}
stack = []
postfix = []
expression = input('Enter your expression: ').split()
for ch in expression:
if ch in operators:
if ch is ')':
while stack and stack[-1] is not '(':
@hamzamuric
hamzamuric / postfix_converter_graphical.py
Last active April 14, 2018 22:34
Convert expression to a postfix notation with GTK+ GUI
from gi.repository import Gtk
class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Postfix")
self.set_border_width(10)
self.set_size_request(250, 150)
# Layout
@hamzamuric
hamzamuric / dvastekaprekojednogniza.c
Created May 3, 2018 14:45
Stek na svaki nacin :D
/* Implementacija dva steka
* preko jednog niza
*/
#include <stdio.h>
#define SIZE 10
int Stack[SIZE], top1 = -1, top2 = SIZE;
// Da li je stek pun
@hamzamuric
hamzamuric / crc.py
Created February 11, 2019 20:22
CRC python implementation
import math
def leftmostone(x):
return math.floor(math.log2(x))
def podeli(a, b):
return int(leftmostone(a) == leftmostone(b))
a = int(input('Unesi broj: '))
b = int(input('Unesi delitelj: '))
@hamzamuric
hamzamuric / ElementaryFileViewer.vala
Created April 13, 2019 17:26
File Viewer for Linux (mostly ElementaryOS) implemented in vala programming language.
using Gtk;
class ElementaryFileViewer : Window {
TextView text_view;
public ElementaryFileViewer() {
var header = new HeaderBar ();
header.title = "Elementary OS";
header.subtitle = "An Elementary OS App";
@hamzamuric
hamzamuric / main.hs
Created April 30, 2019 18:42
Prvo okupljanje kluba programera
// Zadatak 1
reverse' :: [a] -> [a]
reverse' [] = []
reverse' (x:xs) = reverse' xs ++ [x]
// Zadatak 2
unique' :: (Eq a) => [a] -> [a]
unique' [] = []
unique' (x:xs) = x : unique' (filter ((/=) x) xs)
@hamzamuric
hamzamuric / latinica.rs
Last active October 4, 2020 23:47
Osisaj latinicu u fajlu.
use std::env;
use std::fs;
fn main() {
let args: Vec<_> = env::args().collect();
let filename = &args[1];
let contents = fs::read_to_string(filename).expect("Problem reading the file");
let transformed: String = contents.chars().map(|c| ascii_char(c)).collect();