Skip to content

Instantly share code, notes, and snippets.

View danmarz's full-sized avatar
📚
Learning

Dan Dumitrescu danmarz

📚
Learning
View GitHub Profile
@danmarz
danmarz / ntoa.c
Created November 3, 2024 19:58
ntoa test
#include <stdio.h>
#include <stdlib.h>
char* intToAscii(int num) {
// Handle special case for zero
if (num == 0) {
char* str = malloc(2); // Allocate space for "0" and null terminator
if (str == NULL) {
return NULL; // Allocation failed
}
@danmarz
danmarz / main.c
Created October 27, 2024 19:43
rush01 test
#include <stdlib.h>
#include <unistd.h>
#define SIZE 4
// Function to parse input constraints
int parse_constraints(char *input, int constraints[16])
{
int i;
int j;

202025452

@danmarz
danmarz / keybase.md
Created September 25, 2024 17:06
Keybase verification

Keybase proof

I hereby claim:

  • I am danmarz on github.
  • I am danmarius (https://keybase.io/danmarius) on keybase.
  • I have a public key whose fingerprint is ACC2 2FC9 16B2 C732 5247 075F 69A3 CF12 5FBE 00C7

To claim this, I am signing this object:

@danmarz
danmarz / mkcert.sh
Created April 3, 2023 22:39
dovecot SSL configuration script
#!/bin/sh
# Generates a self-signed certificate.
# Edit dovecot-openssl.cnf before running this.
umask 077
OPENSSL=${OPENSSL-openssl}
SSLDIR=${SSLDIR-/etc/ssl}
OPENSSLCONFIG=${OPENSSLCONFIG-dovecot-openssl.cnf}
@danmarz
danmarz / markdown-details-collapsible.md
Created December 3, 2021 20:29 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@danmarz
danmarz / memoized-fibonacci-JSbench.md
Last active November 23, 2021 23:15
Memoization is an optimization technique that speeds up applications by storing the results of expensive function calls and returning the cached result when the same inputs occur again. Check it out -> https://jsbench.me/foktstl85t/1
function fibonacci(n) {
  if (n <= 1) {
    return 1
  }

  return fibonacci(n - 1) + fibonacci(n - 2);
}

function memoizedFibonacci(n, memo) {

Commit Message Guidelines

We have very precise rules over how our git commit messages can be formatted. This leads to more readable messages that are easy to follow when looking through the project history. But also, we use the git commit messages to generate the Angular change log.

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

@danmarz
danmarz / parse-int-query.ts
Created November 16, 2021 12:00 — forked from ezirmusitua/parse-int-query.ts
[Parse integer query params] parse integer query parameters in nestjs #node #nestjs
import {
Controller,
Get,
ParseIntPipe,
Query,
} from '@nestjs/common';
export class GalleryController {
constructor() {
}
@danmarz
danmarz / clean_code.md
Created November 12, 2021 19:19 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules