Skip to content

Instantly share code, notes, and snippets.

View tangingw's full-sized avatar

Mobieus Jay tangingw

View GitHub Profile
@tangingw
tangingw / github-action-ssh.md
Last active May 28, 2024 07:37 — forked from raviagheda/github-action-ssh.md
Github Action with EC2 using SSH
# Set up Postgres
[DigitalOcean Guide for Ubuntu](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-22-04)
# Set up Password
```bash
postgres=# select passwd from pg_shadow where usename='username';
passwd
--------------
md5...
Questions are not from any actual exam!!!
Q: Create a job that calculates pi to 2000 decimal points using the container with the image named perl
and the following commands issued to the container: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
Once the job has completed, check the logs to and export the result to pi-result.txt.
Solution:
# Create Static Ip on master and worker's nodes
1. sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
2. Enter in /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
network: {config: disabled}
3. sudo nano /etc/netplan/01-netcfg.yaml
4. Enter in /etc/netplan/01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
@tangingw
tangingw / Calendar.java
Last active November 11, 2020 14:14
Answer for Creative Exercise 2.1.30 at https://introcs.cs.princeton.edu/java/21function/
public class Calendar {
public static int getDayOfWeek(int day, int month, int year) {
int monthTemp = (14 - month) / 12;
int y0 = year - monthTemp;
int x = y0 + (y0 / 4) - (y0 / 100) + (y0 / 400);
int m0 = month + (12 * monthTemp) - 2;
@tangingw
tangingw / hospital_covid_screening.json
Last active March 30, 2020 04:56
Public Hospital that conduct Covid-19 Screening (GeoJSON)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tangingw
tangingw / json2yaml.py
Created March 28, 2020 09:58 — forked from noahcoad/json2yaml.py
Python to convert json to yaml
#!/usr/bin/env python3
# convert json to yaml
# http://pyyaml.org/wiki/PyYAMLDocumentation
# python3 json2yaml.py < ~/code/manpow/moneybug/mbuploader/support/offices.json
# gist https://gist.github.com/noahcoad/46909253a5891af3699580b8f17baba8
import yaml, json, sys
sys.stdout.write(yaml.dump(json.load(sys.stdin)))

Keybase proof

I hereby claim:

  • I am tangingw on github.
  • I am tangingw (https://keybase.io/tangingw) on keybase.
  • I have a public key whose fingerprint is 4CCD A09D 08D1 D23A 9B55 2D95 87E6 558E 507A A2BE

To claim this, I am signing this object: