Skip to content

Instantly share code, notes, and snippets.

View paulonteri's full-sized avatar
💻
Building

Paul Onteri paulonteri

💻
Building
View GitHub Profile
@paulonteri
paulonteri / leetcode_scrape.js
Created April 30, 2024 19:16
Leetcode Scraper
const axios = require('axios');
let data = JSON.stringify({
query: `query questionContent($titleSlug: String!) {
question(titleSlug: $titleSlug) {
content
mysqlSchemas
dataSchemas
questionId
questionFrontendId
title
@paulonteri
paulonteri / convert.py
Created April 5, 2024 08:01
Convert videos in working folder for Audi MMI
import subprocess
import os
def convert_videos(folder_path):
# Change the current working directory to the target folder
os.chdir(folder_path)
# List all files in the current directory
files = os.listdir(".")

You can use this regular expression to match markdown links:

\[(.*?)\]\(.*?\)

Explanation:

  • \[ and \] match a literal open and close bracket.
  • (.*?) matches any character (.), repeated any number of times (*) but as few as possible (?). The brackets create a capture group.
  • \( and \) match a literal open and close parenthesis.
  • .*? matches any character, repeated any number of times but as few as possible.
@paulonteri
paulonteri / convert_doc_to_docx.sh
Created July 27, 2023 10:28
Convert doc to docx in folder
textutil -convert docx *.doc
@paulonteri
paulonteri / CONSTITUTION-OF-KENYA-2010.txt
Last active April 11, 2023 06:47
CONSTITUTION OF KENYA, 2010
LAWS OF KENYA

Deploy Rails apps to Google Cloud Compute Engine

  • Zero Downtime
  • Graceful shutdowns
  • Via Github Actions
  • Zero infrastructure management overhead

Overview

The general idea is to have Github Actions test, build and deploy a Rails app to Google Cloud Compute Engine.

@paulonteri
paulonteri / paddle-revenue.js
Created September 7, 2022 10:58 — forked from trungdq88/paddle-revenue.js
A scriptable's script to get Paddle revenue from multiple accounts using puppeteer.
/*
RUN THE SCRIPT BY YOURSELF:
- Run `node paddle-revenue.js` on your server and let it run 24/7.
- Access the API at http://your_server_ip:8175/ (JSON)
HOSTED VERSION:
If you don't want to run the script by your own, you can use the
hosted version. The price is $5 per month per Paddle account.
Here is how:
@paulonteri
paulonteri / countries.json
Created September 5, 2022 18:38 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
@paulonteri
paulonteri / gke-gce-cloud-armor-lb.sh
Created August 17, 2022 00:09 — forked from mikesparr/gke-gce-cloud-armor-lb.sh
Example Cloud Armor policies protecting Google HTTPS Global Load Balancer in front of GCE instance group and GKE cluster
#!/usr/bin/env bash
# REF: https://cloud.google.com/armor/docs/integrating-cloud-armor#with_ingress
# REF: https://cloud.google.com/armor/docs/configure-security-policies
# REF: https://cloud.google.com/iap/docs/load-balancer-howto
# REF: https://cloud.google.com/sdk/gcloud/reference/compute/url-maps/add-path-matcher
# REF: https://cloud.google.com/load-balancing/docs/https/setting-up-url-rewrite
export PROJECT_ID=$(gcloud config get-value project)
export PROJECT_USER=$(gcloud config get-value core/account) # set current user
@paulonteri
paulonteri / docker-compose.yml
Created August 8, 2022 07:55
PostHog docker compose
#
# docker-compose file used ONLY for local development.
# For more info, see:
# https://posthog.com/handbook/engineering/developing-locally
#
# If you are looking at self-hosted deployment options check
# https://posthog.com/docs/self-host
#
version: '3'