Skip to content

Instantly share code, notes, and snippets.

View enahsor's full-sized avatar
🎯
Focusing

Dowen Robinson enahsor

🎯
Focusing
View GitHub Profile
@enahsor
enahsor / merge_pdf_into_single_page.py
Created May 26, 2019 14:38
These functions merge the pages of a pdf document into a single page pdf
from PyPDF2 import PdfFileMerger, PdfFileReader, PdfFileWriter
from PyPDF2.pdf import PageObject
import os
def mergePDFDocument(pdf_stream, toAppend="0"):
"""This function merges the pages of a pdf document into a single page.
pdf_stream :: path to pdf document
toAppend :: int to append to end of merged file's name
@enahsor
enahsor / node_nginx_ssl.md
Created March 27, 2020 17:16 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@enahsor
enahsor / node_nginx_ssl.md
Created March 27, 2020 17:16 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

function sayHello(){
alert("Hello world!");
}
@enahsor
enahsor / webrtcp2p.js
Created July 20, 2020 12:02
Shows how to use WEBRTC to sream media using p2p
// REQUIRES SIGNALING MECHANISM
// Examples: Session Initiation Protocol over Websockets, XMPP/Jabber Message, Socket.io
//We'll be using socket.io as our signalling method
//BROWSER A
...
const constraints = {video: true, audio: true}
const peerConnection = new RTCPeerConnection()
@enahsor
enahsor / utils.ts
Last active February 27, 2023 17:25
wait function
export async function wait(seconds: number){
return new Promise<null>((resolve) => {
setTimeout(() => resolve(null), seconds * 1000);
});
}
// await wait(5) - waits 5 seconds before continuing to next statement
@enahsor
enahsor / fieldMask.test.ts
Last active October 19, 2023 17:57
TypeScript utility module to resolve field masks against data objects. It provides a way to selectively filter out parts of an object based on a set of field masks. Supports nested fields and wildcard matching.
import { describe, it, expect } from "bun:test";
import { resolveFieldMasks } from "./fieldMask";
const data = {
level1: {
name: "Dowen",
age: 30,
hobbies: ["programming", "reading"],
address: {
street: "123 Main Street",
@enahsor
enahsor / auth_cloud_run_python.md
Created November 21, 2023 02:41
This guide provides comprehensive instructions for developers looking to authenticate requests to Google Cloud Run services using Python. It outlines two primary methods: leveraging the Google Client Library and utilizing the Requests library. Each method is detailed with step-by-step code examples, making it straightforward for developers to im…

Authenticating to Cloud Run with Python

Prerequisites

  • Create a service account on Google Cloud Platform with the roles/run.invoker role
resource "google_service_account" "service-account" {
  account_id   = "service-account"
 display_name = "A service account description"
@enahsor
enahsor / list.md
Created September 24, 2024 03:58 — forked from ih2502mk/list.md
Quantopian Lectures Saved