Skip to content

Instantly share code, notes, and snippets.

View paulonteri's full-sized avatar
💻
Building

Paul Onteri paulonteri

💻
Building
View GitHub Profile
@mattes
mattes / rails-google-compute-deploy.md
Last active July 29, 2024 04:08
My own Heroku in 30 mins

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.

# connect to mail server using IMAP
client = ImapClient("imap.gmail.com", 993, "username", "password")
# select folder
client.select_folder("Inbox")
# loop through email messages and save them as .eml files
for msg in client.list_messages():
print("Subject: " + msg.subject)
print("HtmlBody: " + msg.html_body)
@lornawanjiru
lornawanjiru / Data-structure-and-algorithm.js
Last active April 18, 2022 17:01
Data structure and algorithm notes. I have tackled a number of questions and realized i would forget some algorithms since I don't repeat the questions as much. I made this gist to help me go through the question intensively.
##Longest Substring with At Most K Distinct Characters
var lengthOfLongestSubstringKDistinct = function(s, k) {
//incase the length of the string is the same or less than the distict number then return the length of the string.
if(k >= s.length ){
return s.length;
}
//define an empty hash map variable.
let hmap = {}
let max = 0;
//iterating through the string.