Skip to content

Instantly share code, notes, and snippets.

View vitran96's full-sized avatar

Chris vitran96

View GitHub Profile
param (
[Parameter(Position = 0, Mandatory = $true)]
[ValidateScript({Test-Path $_ -PathType 'Leaf'})]
[string]$originalPemPath
)
$fileName = (Get-Item -Path $originalPemPath).BaseName
# Get the current user's home directory
$homeDirectory = [Environment]::GetFolderPath("UserProfile")
@vitran96
vitran96 / copyResources.xml
Created April 17, 2023 02:40
Maven snippet
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>parentGroupID</groupId>
<artifactId>parentArtifactID</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
#!/bin/bash
set echo off
echo "Remove cmake if exist"
sudo apt remove -y --purge --auto-remove cmake
echo "Install required packaged"
sudo apt update -y
sudo apt install -y software-properties-common lsb-release
#!/bin/bash
sudo apt update
sudo apt install -y ruby-full wget
# This is for us-east-2 only
# use this snippet for other region
# wget https://aws-codedeploy-<REGION>.s3.<REGION>.amazonaws.com/latest/install
wget https://aws-codedeploy-us-east-2.s3.us-east-2.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto > ./codeDeployAgentInstallation.log
@vitran96
vitran96 / tmux-cheatsheet.markdown
Created July 13, 2021 03:02 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
// Arbitrary precision base conversion by Daniel Gehriger <gehriger@linkcad.com>
// from: https://stackoverflow.com/a/4741402/11217661
#include "BaseConverter.h"
#include <stdexcept>
#include <algorithm>
const char* BaseConverter::binarySet_ = "01";
const char* BaseConverter::decimalSet_ = "0123456789";
@vitran96
vitran96 / constants.js
Last active June 5, 2021 08:51
JSON-Editor usage example
const SCHEMA_EXAMPLE = {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://example.com/product.schema.json",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"productId": {
"description": "The unique identifier for a product",
"type": "integer"
@vitran96
vitran96 / remove blank lines regex.md
Created March 29, 2021 08:13 — forked from fomightez/remove blank lines regex.md
remove all blank lines using regular expressions
@vitran96
vitran96 / 1.Instructions.md
Created March 25, 2021 03:43 — forked from WesThorburn/1.Instructions.md
Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Linux: Compile C++ to WebAssembly and JavaScript using Emscripten and CMake

Download and Install Emscripten

  • My preferred installation location is /home/user
  • Get the latest sdk: git clone https://github.com/emscripten-core/emsdk.git
  • Enter the cloned directory: cd emsdk
  • Install the lastest sdk tools: ./emsdk install latest
  • Activate the latest sdk tools: ./emsdk activate latest
  • Activate path variables: source ./emsdk_env.sh
  • Configure emsdk in your bash profile by running: echo 'source "/home/user/emsdk/emsdk_env.sh"' >> $HOME/.bash_profile
#include <cctype>
#include <algorithm>
#include <string>
inline bool isBlank(const std::string& s)
{
return std::all_of(s.cbegin(),s.cend(),[](char c) { return std::isspace(c); });
}