This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use std::cell::UnsafeCell; | |
| struct MyCell<T> { | |
| value: UnsafeCell<T>, | |
| } | |
| impl<T> MyCell<T> { | |
| fn new(value: T) -> MyCell<T> { | |
| Self { | |
| value: UnsafeCell::new(value), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import collections | |
| import heapq | |
| Connection = collections.namedtuple('Connection', 'node weight') | |
| Route = collections.namedtuple('Route', 'cost path') | |
| class Heap(object): | |
| def __init__(self): | |
| self._values = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| ) | |
| func main() { | |
| fmt.Println("Dijkstra") | |
| // Example | |
| graph := newGraph() | |
| graph.addEdge("S", "B", 4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import hp "container/heap" | |
| type path struct { | |
| value int | |
| nodes []string | |
| } | |
| type minPath []path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| type edge struct { | |
| node string | |
| weight int | |
| } | |
| type graph struct { | |
| nodes map[string][]edge | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bytes" | |
| "encoding/base64" | |
| "fmt" | |
| "io/ioutil" | |
| "mime/multipart" | |
| "net/smtp" | |
| "os" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Delete all containers | |
| docker rm $(docker ps -a -q) | |
| # Delete all images | |
| docker rmi $(docker images -q) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |