Skip to content

Instantly share code, notes, and snippets.

View w-gomes's full-sized avatar
🎯
Focusing

tre w-gomes

🎯
Focusing
View GitHub Profile
@w-gomes
w-gomes / termux-url-opener
Created October 5, 2020 00:57 — forked from LordH3lmchen/termux-url-opener
termux-url-opener
#!/data/data/com.termux/files/usr/bin/zsh
#
# This is a termux-url-opener script to do diffrent tasks on my Android phone
#
#
#
# How to use this script
#############################
# Create the bin directory
# ➜ ~ mkdir bin
@w-gomes
w-gomes / main.cpp
Created September 19, 2020 00:54
Challenge #379 Progressive taxation
/* [2019-07-15] Challenge #379 Progressive taxation
*
* < 10,000 = 0
* 10,000 - 30,000 = 10%
* 30,000 - 100,000 = 25%
* > 100,000 = 40%
*
* https://www.reddit.com/r/dailyprogrammer/comments/cdieag/20190715_challenge_379_easy_progressive_taxation/
*/
// Write a program to compute and print the quartiles (that is, the quarter of
// the numbers with the largest values, the next highest quarter, and so on)
// of a set of integers.
#include <algorithm>
#include <iostream>
#include <vector>
int main() {
std::cout << "Enter some numbers: ";
@w-gomes
w-gomes / main.cpp
Created September 19, 2020 00:47
Challenge #367 Subfactorials
// Derangement
#include <iostream>
unsigned long long int derangement(int n) {
if (n == 0) return 1;
if (n == 1) return 0;
return (n - 1) * (derangement(n - 1) + derangement(n - 2));
}
@w-gomes
w-gomes / compiling_building_c_cpp_notes.md
Created December 3, 2019 16:21 — forked from gubatron/compiling_building_c_cpp_notes.md
Things to remember when compiling and linking C/C++ programs

Things to remember when compiling/linking C/C++ software

by Angel Leon. March 17, 2015; August 29, 2019.

Include Paths

On the compilation phase, you will usually need to specify the different include paths so that the interfaces (.h, .hpp) which define structs, classes, constans, and functions can be found.

With gcc and llvm include paths are passed with -I/path/to/includes, you can pass as many -I as you need.

In Windows, cl.exe takes include paths with the following syntax: /I"c:\path\to\includes\ you can also pass as many as you need.

/bin
- common executables available for everyone, ex. cp rm ls
/boot
- kernel and boot configuration
/dev
- files which point to both physical and pseudo devices
/etc
- system and program configuration files
/home
- non-root user home directories
@w-gomes
w-gomes / vim_cheatsheet.md
Created September 12, 2019 19:42 — forked from awidegreen/vim_cheatsheet.md
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close

Install Redis

wget http://download.redis.io/redis-stable.tar.gz

tar xvzf redis-stable.tar.gz cd redis-stable

make

make install

Ctrl+Z (suspend the process)
bg (restart the process in the background
disown %1 (assuming this is job #1, use jobs to determine)

Keybase proof

I hereby claim:

  • I am w-gomes on github.
  • I am wgomm (https://keybase.io/wgomm) on keybase.
  • I have a public key whose fingerprint is B92E 54F4 6F50 5275 DA29 3762 CD21 9619 87EF 8124

To claim this, I am signing this object: