This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XLSX from 'xlsx'; | |
const readExcelFile = async (filename) => { | |
const workbook = XLSX.readFile(filename); | |
return workbook.SheetNames.reduce((acc, name) => { | |
acc[name] = XLSX.utils.sheet_to_json(workbook.Sheets[name]); | |
return acc; | |
}, {}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const renameObjectKey = (object, oldName, newName) => { | |
// if newName is already present in object, replace it with oldName | |
if ( | |
oldName !== newName && | |
Object.prototype.hasOwnProperty.call(object, oldName) | |
) { | |
object[newName] = object[oldName]; | |
delete object[oldName]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Time complexity: n(n - 1) => n^2 - n | |
const toUniqueArray = async (array) => | |
array.reduce((acc, cur) => { | |
if (!acc.find((elem) => elem === cur)) acc.push(cur); | |
return acc; | |
}, []); | |
const toUniqueArrayIndex = async (array) => { | |
const uniqueIndices = []; | |
const uniqueElements = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* DISCLAIMER */ | |
// This is all useless. Use Intl.NumberFormat instead. | |
const insertString = (string, index, newString) => { | |
return string.substr(0, index) + newString + string.substr(index); | |
}; | |
const separateNumber = (number, separator = " ") => { | |
let string = String(number); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
valgrind \ | |
--leak-check=full \ | |
--show-leak-kinds=all \ | |
--track-origins=yes \ | |
--verbose \ | |
--log-file=valgrind-out.txt \ | |
./executable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
usage() { | |
# additional error messages | |
if [ "$#" -ne 0 ]; then | |
printf "$@\n" >&2; | |
fi | |
printf "Usage: $0 [ -e REGEX_PATTERN ] DIRECTORY [DIRECTORIES...]\n" >&2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse | |
deb-src http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse | |
deb http://archive.ubuntu.com/ubuntu focal-security main restricted universe multiverse | |
deb-src http://archive.ubuntu.com/ubuntu focal-security main restricted universe multiverse | |
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse | |
deb-src http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse | |
deb http://archive.ubuntu.com/ubuntu focal-proposed main restricted universe multiverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This header is redistributed under the Apache License v2.0 with LLVM Exceptions. | |
// The whole license can be found: | |
// https://releases.llvm.org/12.0.0/LICENSE.TXT | |
// The entire implementation of forward_list can be found: | |
// https://github.com/llvm-mirror/libcxx/blob/master/include/forward_list | |
#include <memory> | |
#include <type_traits> | |
using std::allocator_traits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CheckOptions: | |
- key: readability-identifier-naming.ClassCase | |
value: lower_case | |
- key: readability-identifier-naming.ClassMemberCase | |
value: lower_case | |
- key: readability-identifier-naming.ClassMemberPrefix | |
value: s_ | |
- key: readability-identifier-naming.EnumCase | |
value: lower_case | |
- key: readability-identifier-naming.EnumConstantCase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REG ADD "HKCR\MIME\Database\Content Type\image/jpeg" /v Extension /t REG_SZ /d .jpg /f |