Skip to content

Instantly share code, notes, and snippets.

View Silva97's full-sized avatar
🤔
Thinking, of course.

Luiz Felipe Silva Silva97

🤔
Thinking, of course.
View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
struct example {
void (*add)(struct example *, int);
void (*show)(struct example *);
int number;
};
void example_add(struct example *this, int n)
/* Just a simple crackme.
* For compile this crackme, download the CCS tool from:
* https://github.com/Silva97/cli-tools
*
* And run:
* $ gcc `./ccs crackme00.c` -o crackme00
*/
#include <stdio.h>
#include <string.h>
@Silva97
Silva97 / 128bit-division.c
Last active September 30, 2019 21:34
Exemplo de divisão de um número de 128 bits
#include <stdio.h>
#include <inttypes.h>
int asmdiv(uint64_t highq, uint64_t lowq, uint64_t divisor)
{
uint64_t quotient;
uint64_t modulous;
__asm__ __volatile__ (
"movq %[highq], %%rdx\n\t"
@Silva97
Silva97 / main.c
Created September 28, 2019 20:06
Exemplo para o artigo "Modularizando código em C"
// https://medium.com/@FreeDev/modularizando-c%C3%B3digo-em-c-784dc52d1c34
#include <stdio.h>
#include "module.h"
int main(void)
{
printf("Valor: %d\n", sum(3, 7));
return 0;
#include <stdio.h>
#include <stdlib.h>
int getint(int *number);
int main()
{
int n;
fputs("Digite um inteiro cara: ", stdout);
#include <stdio.h>
#include <inttypes.h>
uint32_t fib(int n)
{
register uint32_t r = 0;
__asm__(
"mov $1, %%ebx\n\t"
".lp%=:\n\t"
#include <stdio.h>
int main(void)
{
fputs("Dia da semana(1~7): ", stdout);
printf("Nome do dia: %s\n",
((char [][16]){
"Domingo",
"Segunda",
#include <iostream>
int operator +(int x, std::string str){
return x + std::stoi(str, nullptr, 10);
}
int main(void)
{
int x = 5;
std::string str = "13";
/*********************
* Resolução do problema: https://leetcode.com/problems/reverse-integer/
*********************/
int aux_rev(int x, long long int rev)
{
if(rev > INT_MAX || rev < INT_MIN) return 0;
if(!x) return rev;
return aux_rev(x/10, rev*10 + x%10);
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct test {
char str[10];
int n;
};