Skip to content

Instantly share code, notes, and snippets.

View abdalla-alothman's full-sized avatar

Abdalla Alothman abdalla-alothman

  • Kuwait
View GitHub Profile
@vicentebolea
vicentebolea / terminal_statusbar.c
Created May 20, 2014 06:26
A simple status bar for terminal using ANSI escape sequences
#include <stdio.h>
#include <unistd.h>
#include <string.h>
void statusbar_to_stdout (const char * item, int percentage) {
int i, pos;
char per_bar [50 + 1] = {'-'};
if (percentage > 100) percentage %= 100;
pos = percentage / 2;
printf ("\e[?25l"); // Hide cursor
@alculquicondor
alculquicondor / progressbar.c
Created September 21, 2012 03:56
Console progress bar
#include <stdio.h>
#include <unistd.h>
int main() {
setvbuf(stdout, NULL, _IONBF, 0);
for(int i=0; i<100; i++) {
usleep(70000);
printf("\r");
switch(i%4) {
case 0: printf("/"); break;