View sum.ts
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 function sums the given numbers. | |
* | |
* @param xs - The array to be calculated | |
* @returns The sum of all elements in the number array | |
* | |
* @example | |
* ```typescript | |
* sum(); // 0 | |
* sum([1, 2, 3]); // 6 |
View range.ts
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 function returns a sequence of numbers. | |
* | |
* @param length - The length of the array to create | |
* @returns An array of numbers from 0 to `length` - 1 | |
* | |
* @example | |
* ```typescript | |
* range(0); // [] | |
* range(5); // [0, 1, 2, 3, 4] |
View is_empty.ts
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 function checks if the given value is empty. | |
* | |
* @param input - Any data structure that may be empty | |
* @returns if the `input` is empty | |
* | |
* @example | |
* ```typescript | |
* isEmpty(""); // true | |
* isEmpty([]); // true |
View try_catch.ts
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
/** | |
* Functional wrapper for try…catch… | |
* | |
* @param tryer - The function that may throw. | |
* @param catcher - The function that will be evaluated if `tryer` throws. | |
* @typeParam P - The type of the parameter of tryer; if throw, it will be passed to catcher. | |
* @typeParam T - The return type of tryer. | |
* @typeParam C - The return type of catcher. | |
* @returns A new function that will catch exceptions and send them to the catcher. | |
* |
View .Brewfile
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
tap "homebrew/bundle" | |
tap "homebrew/core" |
View .bash_aliases
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
# | |
# ~/.bash_aliases | |
# | |
# User alias | |
alias cls='clear' | |
alias now='date +"%T"' | |
alias nowdate='date +"%d-%m-%Y"' | |
alias nowtime='now' | |
alias path='echo -e ${PATH//:/\\n}' |
View .bashrc
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
# | |
# ~/.bashrc | |
# | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 |
View aria2.conf
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
#================================================================= | |
# https://gist.github.com/Mogeko/64a20bc441cb43a7b26e416270c10168 | |
# https://github.com/P3TERX/aria2.conf (upstream) | |
# File name:aria2.conf | |
# Description: Aria2 config file | |
# Lisence: MIT | |
# Author: Mogeko, P3TERX | |
# Blog: https://p3terx.com for P3TERX | |
# https://mogeko.me for Mogeko | |
#================================================================= |
View GNU_Brewfile
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
tap "homebrew/bundle" | |
tap "homebrew/core" | |
# Macro processing language | |
brew "m4" | |
# Bourne-Again SHell, a UNIX command interpreter | |
brew "bash" | |
# GNU binary tools for native development | |
brew "binutils" | |
# GNU File, Shell, and Text utilities | |
brew "coreutils" |
View blog-hugo.sh
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 | |
BLOGREPO=$BLOGPATH/.repo/Blog | |
BLOG_POSTS=$BLOGREPO/content/posts | |
BLOG_IMAGES=$BLOGPATH/.repo/blog-images | |
NOWPATH=`pwd` | |
log() { | |
cd $BLOGREPO |
NewerOlder