Skip to content

Instantly share code, notes, and snippets.

View darrensapalo's full-sized avatar

Darren darrensapalo

View GitHub Profile
@darrensapalo
darrensapalo / websocat-sample.sh
Created July 7, 2022 07:48
Using websocat to perform a CLI request using websockets to a hasura engine
#! /usr/bin/bash
# Using WebSocat
# https://github.com/vi/websocat/blob/master/moreexamples.md
# Reset by killing process
#
# 1. Get all processes
# 2. general regexp to find websocat process di
# 3. Get the second column of results
@darrensapalo
darrensapalo / ubuntu-wireguard-restart-script.fish
Created February 10, 2022 16:34
Automatically reconnect clunky wireguard on Ubuntu
#! /usr/local/bin/fish
# Returns the HTTP Status Code of the HTTP request, connecting to some public
# internet page.
function check_online
set RESPONSE (curl -m 2 -Is $argv[1] | grep HTTP | cut -d ' ' -f2)
if test $RESPONSE = ""
echo "200"
else
echo $RESPONSE
@darrensapalo
darrensapalo / my-notes.md
Last active September 25, 2021 14:27
Creating Safe Spaces (Within Yourself)

Risk: Having only one leg of support (or one safe space) is risky. What if one space fails? People need multiple places where they can ask for help (or ask for space to be listened to).

More safe spaces; more stable. How might we empower and enable others to build healthy and safe spaces? How does one ask for what they want, and and how does one learn and set their boundaries?

Covid impact: everyone has limited spaces you have access to; especially for children

@darrensapalo
darrensapalo / Fix.md
Last active September 23, 2021 03:03
Fix gdocs, gfix, gci, gref to have emoji after the colon

Using https://github.com/gazorby/fish-git-emojis , to fix your fisher gci gdocs or gfix commands so that the emoji is after the colon (for conventional commits format), edit this file:

~/.config/fish/functions/_gc.fish

You want the switch case to look like this:

 switch (count $argv)
@darrensapalo
darrensapalo / bayani-pay-disbursed-sample.html
Last active June 10, 2021 23:21
Sample disbursed email template
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Successfully disbursed</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
Your remittance of amount {{amount}} was successfully transferred to {{recipient}}.
Thank you for transacting with Bayani Pay.
@darrensapalo
darrensapalo / port-forward-to-pgadmin.fish
Last active June 10, 2021 16:02
Automatically connects to the utils namespace, and then finds the pod with pgadmin, and portforwards it to 4000.
#! /usr/local/bin/fish
# This fish scripts allows one to automatically:
# 2. connect to the utils kubens
# 3. port-forward the pgadmin service
kubens utils
set HANDLER_POD_NAME (kubectl get pods -o jsonpath="{.items[*].metadata.name}" | tr -s '[[:space:]]' '\n' | grep pgadmin)
kubectl port-forward $HANDLER_POD_NAME 4000:80
@darrensapalo
darrensapalo / preprocess-json-logs.fish
Created May 11, 2021 13:21
Preprocesses winston logs using fish string-replace CLI command
#! /usr/bin/fish
cp logs/review.log logs/raw.log
string replace -a '{"message":"' '' (cat logs/raw.log) > logs/raw.log
string replace -a '","level":"info","service":"dinein-cli"}' '' (cat logs/raw.log) > logs/raw.log
string replace -a '\"' '"' (cat logs/raw.log) > logs/raw.log
string replace -a -r "\\\\\\\\n" '\\n' (cat logs/raw.log) > logs/raw.log
string replace -a -r '\\\\n' '\\n' (cat logs/raw.log) > logs/raw.log
string replace -a -r '\\\\t' '' (cat logs/raw.log) > logs/reviewed.log

CI/CD Devops tasks

The following is a checklist to make sure deployments work on our microservice deployments.

  • On Gitlab CI/CD values, fix host URLs to follow format SERVICENAME.<env>.bayanipay.us;
  • Cross check Gitlab CI/CD values to match the values.yaml fixes below:
    • On values.yaml, fix cluster issuer acme challenges from http01 to dns01
    • On values.yaml, fix image.hasura.tag to v1.3.3
    • On values.yaml, fix ingress.tls.hosts.secretName to SERVICENAME-tls
    • On values.yaml, fix ingress.hosts.host to SERVICENAME.dev.bayanipay.us
@darrensapalo
darrensapalo / contribute.md
Created March 10, 2021 15:00
How do I contribute to Sinigang Valley?

How do I contribute?

My experience was involvement in RapidPass, and contributing to building the QR Pass... pandemic tech.

Building an openness framework

My thoughts are that we need an openness framework that allows us to interoperate... enabling people (tech, business, students anything) to contribute. To be part of the story.

Ang daming gustong tumulong, pero hindi lang alam kung paano.

@darrensapalo
darrensapalo / Leverage, from Idea to Application - thoughts.md
Last active February 23, 2021 07:01
Leverage, growth, knowledge

@darrensapalo (Twitter)

On understanding leverage from the fog of war of inexperience

Sahil mentioned a while ago 20 year olds who say "I want to be a VC..." and he was like, "What are you doing?"

Lookign back at what a person went through to get to where they are (VCs, entrepreneurs, etc), it makes a lot of sense in hindsight. How might we look at it from a different perspective?

I think a better framing of a question, in line with leverage, is: what should I be doing at a certain time?