Skip to content

Instantly share code, notes, and snippets.

View amoretspero's full-sized avatar
🏠
Working from home

Jiung amoretspero

🏠
Working from home
View GitHub Profile
@amoretspero
amoretspero / ubuntu_python_upgrade.sh
Created August 9, 2020 10:41
Upgrade python version on ubuntu (>= 18.04)
# 0. Get official distribution. Substitue 'x' with desired version.
sudo apt-get install python3.x
# 1. Get all installed python3 distributions
ls -alh /usr/bin | grep python3
# 2. Add installed python3 version to update-alternatives
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.x
# 3. Configure update-alternatives.
@amoretspero
amoretspero / mergesort_comparison_count.js
Created September 19, 2019 06:22
Mergesort comparison count
let count = 0;
/**
* An implementation for Mergesort. Less efficient
* than Quicksort. Again, you'd just use Array.sort
* but if you found yourself unable to use that
* there's always this option.
*
* Tests with:
*
* var array = [];
@amoretspero
amoretspero / heapsort_comparison_count.js
Last active September 19, 2019 06:22
Heapsort comparison count
let count = 0;
function shuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
@amoretspero
amoretspero / quicksort_comparison_count_random_pivot.js
Last active September 19, 2019 06:22
Quicksort comparison count for random pivot
#!/usr/bin/env node
//
// Count the number of comparisons required by quicksort using the following
// three pivot-selection strategies:
//
// 1. Always pick the first element.
// 2. Always pick the last element.
// 3. Pick the median of the first, last, and middle elements. If the list
// length is even, pick the element with the smaller index.
//
@amoretspero
amoretspero / ACM_Code_of_Ethics_and_Professional_Conduct_ko_KR.md
Last active December 23, 2021 08:49
ACM code of ethics and professional translation in korean.

ACM Code of Ethics and Professional Conduct

윤리 및 전문성에 관한 행동 강령 - ACM

Adopted by ACM council 10/16/92.
1992년 10월 16일에 ACM 위원회에 의해 적용됨.

Preamble

@amoretspero
amoretspero / lerna-typescript-existing-packages.md
Created January 23, 2019 00:47
Configuring lerna with existing typescript packages.

Configuring lerna with existing typescript packages.

  1. Create new monorepo directory. (If needed, run git init and add appropriate .gitignore file.)
  2. Run lerna init. If versions of each packages differ from each other, remove version from lerna.json.
  3. Run npm install
  4. Copy existing packages to packages folder.
  5. Remove previous dependencies with each other from all packages.
  6. Set prepublishOnly of package.json of each file to npm run build. (If needed, make "tsconfig.json" at "packages" folder for package references, "tsconfig.settings.json" for common settings to extended by each package's tsconfig.json.)
  7. For packages referencing other package(s), set references of tsconfig.json file.
  8. Set outDir and rootDir of tsconfig.json of each package to appropriate values if needed.
import java.lang.Math; // headers MUST be above the first class
import java.util.*;
// one class needs to have a main() method
public class Sort {
// arguments are passed using the text field below this editor
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Please insert array size of 10:");
GET http://myrestfulblog.io/articles # Gets List of articles.
GET http://myrestfulblog.io/articles/10 # Gets article No. 10.
POST http://myrestfulblog.io/articles/create # Create new article.
DELETE http://myrestfulblog.io/articles/3 # Deletes article No. 3.
PATCH http://myrestfulblog.io/articles/5 # Update article No. 5.
@amoretspero
amoretspero / function.ts
Created October 27, 2017 15:43
Multi-function serverless framework command issuer.
import {exec, spawn} from "child_process";
import * as fs from "fs";
import * as path from "path";
const indivitualUsage = "ts-node function.ts <command> [--function <function>] [--args <args list...>]";
const npmUsage = "npm run <command> -- [--function <function>] [--args <args list...>]";
const commands = [
"webpack",
"package",
@amoretspero
amoretspero / serverless.md
Last active July 14, 2020 05:12
Serverless framework directory structure and KMS integration for Multi-function case.

Serverless with multiple functions

This gist describes multi-function-in-one-project case of serverless framework for AWS lambda.

Features

Usage