Skip to content

Instantly share code, notes, and snippets.

View mfurquimdev's full-sized avatar
🐧

Mateus Furquim mfurquimdev

🐧
View GitHub Profile
@mfurquimdev
mfurquimdev / 1221.c
Last active November 17, 2017 03:59
Numberphile sequences
// The Kolakoski Sequence
// https://youtu.be/co5sOgZ3XcM
#include <stdio.h>
#define MAX 99
int main()
{
unsigned int seq[MAX];
@mfurquimdev
mfurquimdev / return_a_function_pointer.c
Last active November 16, 2017 20:53
A program in C Language which uses two parameters as input and returns the result of any one of the four basic math operations. This is decided with a char and a function pointer is returned to be used in the main function.
#include <stdio.h>
typedef float (*pt2Func)(float, float);
float Plus (float a, float b) { return a+b; }
float Minus (float a, float b) { return a-b; }
float Multiply (float a, float b) { return a*b; }
float Divide (float a, float b) { return a/b; }
pt2Func GetPtr2 (const char opCode)
@mfurquimdev
mfurquimdev / post-installation
Last active November 5, 2019 17:32
Arch Linux
pacman --noconfirm -S \
base{,-devel} \
vim \
tree \
git \
mlocate \
openssh \
xorg{,-xinit} \
firefox \
rfkill
@mfurquimdev
mfurquimdev / soba.md
Last active October 31, 2021 23:57
StackOverflow Best Answers
@mfurquimdev
mfurquimdev / gen_sshkey.sh
Last active March 12, 2019 18:41
Generate ssh key with nice comment, no password and default place.
# Linux
ssh-keygen -t rsa -b 4096 -C "$USER@$(uname -n).$(cut -f 1 -d ' ' /etc/issue | head -n 1 | sed -e 's/\(.*\)/\L\1/')" -N '' -f /home/$USER/.ssh/id_rsa
# Mac OS
ssh-keygen -t rsa -b 4096 -C "$USER@$(uname -n).$(sw_vers | head -1 | cut -c 14-19)" -N '' -f /Users/$USER/.ssh/id_rsa
@mfurquimdev
mfurquimdev / bash_colors.sh
Last active July 8, 2021 20:18
A variety of special mod, and {fore,back}ground colors.
#!/bin/bash
for m in {0..9}; do
for i in {0..9}; do
for C in {30..37} {90..97}; do
echo -en "\033[${i};${m};${C}m"
printf "e[%2d;%2d;%3d" ${i} ${m} ${C}
echo -en "\033(B\033[m "
done
echo
@mfurquimdev
mfurquimdev / Makefile
Created July 15, 2016 20:50
Spellstone cards analyzer (w/ cJSON)
.PHONY: all clean
all:
gcc -W -Wall -ansi -pedantic -std=c99 -lm -o spellstone spellstone.c cJSON.c -I/usr/include/
clean:
rm -vf spellstone
@mfurquimdev
mfurquimdev / year_calendar.c
Created July 14, 2016 02:01
Divide a rectangle (w,h) into smaller X rectangles
// gcc -W -Wall -ansi -pedantic -std=c99 -lm -o yfc year_calendar.c
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <tgmath.h>
#include <getopt.h>
float max(float, float);
@mfurquimdev
mfurquimdev / Andre.cpp
Created July 1, 2015 04:35
Heart frequency analysis
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
static const int WINDOW = 120000;
float sdnn_function (float*, int);
float rmssd_function (float*, int);
This post examines the features of [R Markdown](http://www.rstudio.org/docs/authoring/using_markdown)
using [knitr](http://yihui.name/knitr/) in Rstudio 0.96.
This combination of tools provides an exciting improvement in usability for
[reproducible analysis](http://stats.stackexchange.com/a/15006/183).
Specifically, this post
(1) discusses getting started with R Markdown and `knitr` in Rstudio 0.96;
(2) provides a basic example of producing console output and plots using R Markdown;
(3) highlights several code chunk options such as caching and controlling how input and output is displayed;
(4) demonstrates use of standard Markdown notation as well as the extended features of formulas and tables; and
(5) discusses the implications of R Markdown.