Skip to content

Instantly share code, notes, and snippets.

@hendryfoe
hendryfoe / nginx.conf
Created February 24, 2021 11:36 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@hendryfoe
hendryfoe / example-resume.json
Last active September 11, 2022 15:35
Example resume content
{
"contact": {
"firstName": "John",
"lastName": "Doe",
"phone": "+1 123 456 789",
"email": "[email protected]",
"linkedin": "https://www.linkedin.com/in/johndoe",
"summary": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat"
},
"experiences": [
@hendryfoe
hendryfoe / chunk.js
Created November 6, 2022 15:52
chunk items
function chunk(items: string[], size: number) {
const chunks = [];
items = ([] as string[]).concat(...items);
while (items.length) {
chunks.push(items.splice(0, size));
}
return chunks;
}
@hendryfoe
hendryfoe / format-currency.js
Created November 6, 2022 15:53
format currency utility
export function formatCurrency(
value: number,
locales: string | string[] = 'id',
options: Intl.NumberFormatOptions = { style: 'currency', currency: 'IDR', minimumFractionDigits: 0 }
) {
return new Intl.NumberFormat(locales, options).format(value);
}
export function formatCurrencyWithoutPrefix(value: number, locales: string | string[] = 'id') {
return formatCurrency(value, locales, {});
@hendryfoe
hendryfoe / find.sh
Created February 12, 2023 06:23
"find" command in linux
# https://www.freecodecamp.org/news/how-to-search-files-in-the-linux-terminal/
find -name <file_name>
# find file by "case-insensitive"
find -iname <file_name>
# find file by "regex / pattern"
find /path/to/search -name "*.txt"
@hendryfoe
hendryfoe / clean_code.md
Created April 8, 2023 09:44 — 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

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@hendryfoe
hendryfoe / multiple_ssh_setting.md
Created December 2, 2023 03:48 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"