Skip to content

Instantly share code, notes, and snippets.

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

Kian Ortillan mortillan

🏠
Working from home
  • White Cloak Technologies Inc
  • Philippines
View GitHub Profile
@mortillan
mortillan / Demo: String Templates in Bash .md
Created October 14, 2022 06:49 — forked from Jeff-Russ/Demo: String Templates in Bash .md
The best way to create a multiline document template (shell)

Demo: String Templates in Bash

The best way to create a multiline string template variable which has variables within it and contains double quotes.

IMPORTANT: The variable inserts must be assigned before the string template is declared and before it's used! EACH TIME THE INSERTS ARE MODIFIED, THE TEMPLATE MUST BE RE-RECLARED! For this reason it's sometimes handy to put the template def inside a function so you can call/re-call it before using it.

@mortillan
mortillan / my_program.conf
Last active April 20, 2020 04:59
Running Python worker in background using Supervisor and venv
# Install supervisor to Linux machine, in Ubuntu, sudo apt-get install supervisor is good enough.
# Place the file in /etc/supervisor/conf.d/
[supervisord]
logfile_maxbytes=100MB
logfile_backups=7
[program:my_program]
command=/home/ubuntu/my_project/.venv/bin/python -u /home/ubuntu/my_project/src/workers/img_merge_generator.py
directory=/home/ubuntu
autostart=true
@mortillan
mortillan / Problem.txt
Created January 28, 2020 15:20
Jumping on the Clouds Machine Problem
Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus or . She must avoid the thunderheads. Determine the minimum number of jumps it will take Emma to jump from her starting postion to the last cloud. It is always possible to win the game.
For each game, Emma will get an array of clouds numbered if they are safe or if they must be avoided. For example, indexed from . The number on each cloud is its index in the list so she must avoid the clouds at indexes and . She could follow the following two paths: or . The first path takes jumps while the second takes .
Function Description
Complete the jumpingOnClouds function in the editor below. It should return the minimum number of jumps required, as an integer.
jumpingOnClouds has the following parameter(s):
@mortillan
mortillan / challenge1.js
Created January 21, 2020 02:14
M0sc0rd Exam
const people = [
{ name: 'Arisa', department: 'BP', gender: 'F' },
{ name: 'Ham', department: 'IT', gender: 'F' },
{ name: 'Alice', department: 'IT', gender: 'F' },
{ name: 'Anna', department: 'DA', gender: 'F' },
{ name: 'Larry', department: 'Sales', gender: 'M' },
{ name: 'Ria', department: 'Sales', gender: 'F' },
{ name: 'JD', department: 'Sales', gender: 'M' },
{ name: 'Thor', department: 'Sales', gender: 'M' },
{ name: 'Karl', department: 'Sales', gender: 'M' },