Skip to content

Instantly share code, notes, and snippets.

View tnedev's full-sized avatar

Tihomir Nedev tnedev

View GitHub Profile
@tnedev
tnedev / panic_email.ino
Created April 26, 2014 14:11
Arduino - Send an email when panic switch was pressed
/*
Tihomir Nedev
April 2014
Change the values for the network setting.
Change the emails. NB! Some sorvers won't accept email for unedentified devices as Arduino.
Hardware: Arduino board + Ethernet shield
*/
@tnedev
tnedev / magic_square.py
Created April 26, 2014 11:20
Magic Square
import math
def magic_square(matrix):
magic_addition = []
addition = 0
counter = 0
counter2 = 0
power = len(matrix)
for item in matrix:
for element in item:
addition+=element
@tnedev
tnedev / reduce_file_path.py
Created April 24, 2014 12:54
Reduce file path
def kill_char(string, n):
begin = string[:n]
end = string[n+1:]
return begin + end
def reduce_file_path(path):
counter=1
if path[len(path)-1]=='.':
path = kill_char(path,len(path)-1)
if len(path)>1:
@tnedev
tnedev / goldbach.py
Last active August 29, 2015 14:00
Goldbach Conjecture
"""
Implement a function, called goldbach(n) which returns a list of tupples, that is the goldbach conjecture for the given number n
The Goldbach Conjecture states:
Every even integer greater than 2 can be expressed as the sum of two primes.
Keep in mind that there can be more than one combination of two primes, that sums up to the given number.
The result should be sorted by the first item in the tuple.