Skip to content

Instantly share code, notes, and snippets.

View douglasmakey's full-sized avatar
🏠
Working from home

Douglas Makey Mendez Molero douglasmakey

🏠
Working from home
View GitHub Profile
import collections
import heapq
Connection = collections.namedtuple('Connection', 'node weight')
Route = collections.namedtuple('Route', 'cost path')
class Heap(object):
def __init__(self):
self._values = []
package main
import (
"fmt"
)
func main() {
fmt.Println("Dijkstra")
// Example
graph := newGraph()
graph.addEdge("S", "B", 4)
package main
import hp "container/heap"
type path struct {
value int
nodes []string
}
type minPath []path
package main
type edge struct {
node string
weight int
}
type graph struct {
nodes map[string][]edge
}
@douglasmakey
douglasmakey / sender.go
Last active August 20, 2024 05:40
Golang - send an email with attachments.
package main
import (
"bytes"
"encoding/base64"
"fmt"
"io/ioutil"
"mime/multipart"
"net/smtp"
"os"
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
delete the app from the Applications folder
delete the invisible .atom directory from the home folder
delete the /usr/local/bin/atom tool
delete the /usr/local/bin/apm tool
delete the ~/Library/Preferences/com.github.atom.plist file
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
class ConnectPSQL(object):
_instance = None
_session = None
def __new__(cls, *args, **kwargs):
if not cls._instance:
cls._instance = super(ConnectPSQL, cls).__new__(cls, *args, **kwargs)
Session = None