Skip to content

Instantly share code, notes, and snippets.

View manvscode's full-sized avatar
💭
Coding.

Joe Marrero manvscode

💭
Coding.
View GitHub Profile
@manvscode
manvscode / rpi_dwm.md
Created March 3, 2023 04:24 — forked from luk707/rpi_dwm.md
Setting up DWM on a Raspberry Pi running Raspbian lite

Setting up DWM on a Raspberry Pi running Raspbian lite

Make sure git is intalled

sudo apt install git

Clone the repository from suckless:

#include <stdio.h>
#include <stdlib.h>
#include <term.h>
#include <curses.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
int status = 0;
@manvscode
manvscode / toothnumber.c
Created May 25, 2022 15:40
Is first or second molar?
#include <stdio.h>
#include <stdbool.h>
static bool is_first_molar(int tooth)
{
return tooth % 10 == 6;
}
static bool is_second_molar(int tooth)
{
@manvscode
manvscode / stacktrace.c
Created May 25, 2022 15:35
Custom segmentation fault handler
#include <stdio.h>
#include <execinfo.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
void handler(int sig) {
void *array[10];
size_t size;
@manvscode
manvscode / timezone-test.c
Last active May 25, 2022 15:36
Example of how to work with timezones in C
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
int main( int argc, char* argv[] )
{
char buffer[ 128 ];
time_t now = time(NULL);
const char* time_str = "";
@manvscode
manvscode / CDN.md
Created July 18, 2020 19:37 — forked from vinkla/CDN.md
A guide on how to upload images to GitHub's CDN through issues and pull requests.

Upload Images to GitHub's CDN

  1. First, visit any repository on GitHub and click your way through to the issues page.

  2. Create a new issue by clicking the New Issue button. You'll now see title and description fields.

  3. Drag-and-drop an image onto the description field. This will start the uploading process.

  4. Copy the URL and use it in README, issues or pull requests however you like.

@manvscode
manvscode / effective_modern_cmake.md
Created March 21, 2020 04:49 — forked from mbinna/effective_modern_cmake.md
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@manvscode
manvscode / .gitconfig
Created December 2, 2019 21:41 — forked from shawndumas/.gitconfig
Using WinMerge as the git Diff/Merge Tool on Windows 64bit
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[merge]
tool = winmerge
[mergetool "winmerge"]
name = WinMerge
@manvscode
manvscode / docker-cleanup-resources.md
Created November 26, 2019 23:05 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

/// <summary>
/// Fast exponential approximation.
/// </summary>
/// <remarks>
/// Based on "A Fast, Compact Approximation of the Exponential Function" by Nicol N.Schraudolph (1999)
/// <code>e^x ~ a*x + b
/// a = 2 ^ (mantissa bits) / ln(2) ~ 12102203
/// b = (exponent bias) * 2^(mantissa bits) ~ 1065353216</code>
/// </remarks>
/// <param name="x">A number specifying a power.</param>