Skip to content

Instantly share code, notes, and snippets.

View mogeko's full-sized avatar
🇵🇸
FREE PALESTINE !!!

Zheng Junyi mogeko

🇵🇸
FREE PALESTINE !!!
  • Contemporary Amperex Technology Hungary Kft.
  • Debrecen, Hungary
  • 18:57 (UTC +02:00)
View GitHub Profile
@mogeko
mogeko / Office2010_Retail2VOL_Activate.cmd
Created April 20, 2019 02:23
Convert Microsoft Office VOL License to a Retail License.
@echo off
:ADMIN
openfiles >nul 2>nul ||(
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs" >nul 2>&1
goto:eof
)
del /f /q "%temp%\getadmin.vbs" >nul 2>nul
@mogeko
mogeko / is_empty.ts
Created October 31, 2022 00:11
This function checks if the given value is empty.
/**
* 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
@mogeko
mogeko / sum.ts
Created October 31, 2022 00:13
This function sums the given numbers.
/**
* 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
@mogeko
mogeko / range.ts
Last active October 31, 2022 01:03
This function returns a sequence of numbers.
/**
* 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]
@mogeko
mogeko / try_catch.ts
Last active October 31, 2022 14:53
Functional wrapper for try…catch…
/**
* 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.
*
@mogeko
mogeko / aria2.conf
Last active February 4, 2023 16:29
Aria2 config file
#=================================================================
# 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
#=================================================================