Skip to content

Instantly share code, notes, and snippets.

Avatar

Samuel Santos samueltcsantos

View GitHub Profile
@samueltcsantos
samueltcsantos / Update remote repo
Created Aug 24, 2017 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
View Update remote repo
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd $HOME/Code/repo-directory
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/mandiwise/awesome-new-repo.git
$ git push origin master
$ git remote rm bitbucket
View wemos_server.ino
#include <ESP8266WiFi.h>
const char* ssid = "Wi-Fi_Network";
const char* password = "network#123";
WiFiServer server(80);
void setup() {
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
@samueltcsantos
samueltcsantos / overflow.c
Created May 20, 2017
Trying to do underflow and overflow in C language for the integer Type.
View overflow.c
#include <stdio.h>
#include <limits.h>
int main(){
int maxValue = INT_MAX;
int minValue = INT_MIN;
int overflow = 0;
int underflow = 0;
@samueltcsantos
samueltcsantos / decimal-hexa.c
Last active May 6, 2017
Convert from decimal to hexadecimal
View decimal-hexa.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BITS 64
/**
* @desc Algorithm to convert decimal to hexadecimal.
*
* Compile: gcc decimal-hexa.c -o toHex
View binary-to-decimal.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/**
* @desc Algorithm to convert binary to decimal number.
*
* Compile: gcc binary-to-decimal.c -o toDecimal -lm
* Run: ./toDecimal 10100101
*
@samueltcsantos
samueltcsantos / binary-little-endian.c
Created May 2, 2017
Converter decimal to binary using the little endian format.
View binary-little-endian.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define BIT_0 "0"
#define BIT_1 "1"
/**
@samueltcsantos
samueltcsantos / reverse.c
Created May 1, 2017
Reverse the string content using a function.
View reverse.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/**
* @desc Algorithm to reverse a string passed by command line as argument.
*
* Compile: * gcc -o reverse.c -o reverse
* Run: ./reverse SAMARA
*
@samueltcsantos
samueltcsantos / invert-string.c
Created May 1, 2017
Reverse a text algoritm
View invert-string.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/**
* @desc Algorithm to reverse a string passed by command line as argument.
*
* Compile: * gcc -o invert-string.c -o invert
* Run: ./invert SAMARA
*
@samueltcsantos
samueltcsantos / binary-bigendian.c
Last active May 1, 2017
Convert decimal to binary using Big-Endian notation.
View binary-bigendian.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define BIT_0 "0"
#define BIT_1 "1"
int main(int argc , char **argv){
@samueltcsantos
samueltcsantos / binary.c
Created Apr 29, 2017
How to read arguments from command line.
View binary.c
#include <stdio.h>
int main(int argc , char **argv){
for (int i=0; i < argc; ++i)
{
printf("argv[%d]: %s \n", i, argv[i]);
}
}