Skip to content

Instantly share code, notes, and snippets.

View dusansimic's full-sized avatar
🫠
Working 3.5 jobs at the moment

Dušan Simić dusansimic

🫠
Working 3.5 jobs at the moment
View GitHub Profile
@dusansimic
dusansimic / swap.c
Created October 1, 2016 20:06
Swap two numbers with macro code.
#define swap(a, b) do { \
typeof(a) temp = a; \
a = b; \
b = temp; \
} while (0);
@dusansimic
dusansimic / progress-bar.py
Created August 2, 2016 15:46
Simple progress bar in python.
import time
import sys
toolbar_width = 40
current = 0
for i in range(1, 101):
time.sleep(0.1)
@dusansimic
dusansimic / spinner.py
Last active September 12, 2016 00:10
Spinner in python.
import sys
import time
def spinning_cursor():
while True:
for cursor in '|/-\\':
yield cursor
def start():
spinner = spinning_cursor()
@dusansimic
dusansimic / cli.py
Created August 1, 2016 11:09
Small python script for clearing console window.
import os
import sys
if sys.platform() == "win32":
def clear(): os.system("cls")
elif sys.platform() == "linux2":
def clear(): os.system("clear")
elif sys.platform() == "cygwin":
def clear(): os.system("clear")
elif sys.platform() == "darwin":