| Instance | Branch |
|---|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| git filter-branch -f --env-filter ' | |
| OLD_EMAIL="vicentebolea@gmail.com" | |
| CORRECT_NAME="Vicente Adolfo Bolea Sanchez" | |
| CORRECT_EMAIL="vicente.bolea@gmail.com" | |
| if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
| then | |
| export GIT_COMMITTER_NAME="$CORRECT_NAME" | |
| export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //! EX: char* my_ip = ip_of ("eth0"); | |
| #include <ifaddrs.h> | |
| char* ip_of (const char* interface) { | |
| static char if_ip [INET_ADDRSTRLEN]; | |
| struct ifaddrs *ifAddrStruct = NULL, *ifa = NULL; | |
| getifaddrs (&ifAddrStruct); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <string.h> | |
| #include <uthash.h> | |
| // this is an example of how to do a LRU cache in C using uthash | |
| // http://uthash.sourceforge.net/ | |
| // by Jehiah Czebotar 2011 - jehiah@gmail.com | |
| // this code is in the public domain http://unlicense.org/ | |
| #define MAX_CACHE_SIZE 100000 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Reset the stdout stream with the porpose | |
| * of reset the orientation of stdout in order | |
| * to alternate between printf and wprintf | |
| */ | |
| void reset_stdout_orientation (void) { | |
| freopen ("/dev/stdout", "a", stdout); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * It assume that the string is at maximum of 32 bits, | |
| * also assume that the binary has maximum 32 bits width | |
| */ | |
| void bin_to_str (int binary, char* str, size_t size) { | |
| if (size != 32 && size != 16 && size != 8) return; | |
| int i; | |
| for (i = 1; i <= size; i++) | |
| str [size-i] = (binary & (1<<(i-1))) ? '1': '0'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| simple rule: | |
| we have object A and object Z. | |
| if we have a pointer from object A to object Z then its aggregation.(no pointing from Z to A ,since it maks a simple relation). | |
| if object Z cannot exists in the system without object A, then its composition. | |
| its not that hard, even more ITS NOT THAT USEFUL. why? beacuse no body uses this stuff to the fine lines, its a loose model that lets you grasp what you want from the system. |
NewerOlder