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 / StationClass.fs
Created June 22, 2016 16:24
Data Communication simulation - station class
type station (name : string, chargeTime : int) =
member val name = name
member val backoff = -1 with get, set
member val chargeTime = chargeTime with get, set
member val transmit = false with get, set
member val collisionDetectTime = -1 with get, set
member val transmitTime = -1 with get, set
member val currentPacketNumber = 0 with get, set
member val waitACK = -1 with get, set
member val ackTransmit = false with get, set
@amoretspero
amoretspero / ServerSideCode-CSharp-ASPdotNETCore.cs
Created May 18, 2017 12:32
Sample code for server-side C#, ASP.NET Core.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using csatdb.Models;
using csatdb.Models.ExamSearchViewModels;
using csatdb.Data;
@amoretspero
amoretspero / ClientSideCode-HTML-Razor-Index.cshtml
Created May 18, 2017 12:33
Sample code for client-side code in HTML and Razor.
@model ExamSearchIndexViewModel
@{
ViewData["Title"] = "";
Layout = "_Layout_Testcloud_Main";
}
@section Metatags {
<meta name="description" content="기클: 기출문제클라우드는 캠퍼스박스에서 제공하는 기출문제 검색 서비스입니다. 원하는 기출문제와 해설을 간단하게 다운로드할 수 있으며, 등급컷과 난이도 정보 역시 확인할 수 있습니다." />
}
@amoretspero
amoretspero / ClientSideCode-JavaScript.js
Created May 18, 2017 12:34
Sample code for client-side code in JavaScript
/*
==========
File name: examsearch-index.js
This javascript file contains javascript codes that should be used only at /ExamSearch/Index.cshtml
Codes that are used at other files or codes that can also be used at some other files should not go here.
Codes that can also be used at some other files should go to:
1) site.js -> When That code is used over the entire site.
2) ***.js -> When code is not used over the entire site, but shared by plural files.
@amoretspero
amoretspero / az-vm-create--with-existing-vhd.txt
Last active June 8, 2017 09:37
azure-cli template for azure vm creation with existing vhd file.
===Prerequisites===
1. Azure Cli (on bash on Ubuntu on Windows OR powershell OR Linux shell OR MacOS)
2. vhd image of previously deployed VM
3. storage account to add vhd.
===Steps===
1. Create Storage account in Azure portal or azure-cli.
Storage account type does not matter. Choose at your needs.
@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

@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",
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.
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:");
@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.