Skip to content

Instantly share code, notes, and snippets.

View Algogator's full-sized avatar
💭
I may be slow to respond.

Algogator

💭
I may be slow to respond.
View GitHub Profile
@Algogator
Algogator / gist:90e11cfe59656e0e08c03cb41b177768
Created October 22, 2023 17:52 — forked from psayre23/gist:c30a821239f4818b0709
Runtime Complexity of Java Collections
Below are the Big O performance of common functions of different Java Collections.
List | Add | Remove | Get | Contains | Next | Data Structure
---------------------|------|--------|------|----------|------|---------------
ArrayList | O(1) | O(n) | O(1) | O(n) | O(1) | Array
LinkedList | O(1) | O(1) | O(n) | O(n) | O(1) | Linked List
CopyOnWriteArrayList | O(n) | O(n) | O(1) | O(n) | O(1) | Array
@Algogator
Algogator / t.py
Last active September 29, 2020 13:12
Topo
# numCourses = 4, prerequisites = [[1,0],[2,0],[3,1],[3,2]]
from collections import defaultdict, deque
class Solution:
def findOrder(self, numCourses, prerequisites):
"""
:type numCourses: int
:type prerequisites: List[List[int]]
:rtype: List[int]
@Algogator
Algogator / pointer.cpp
Last active September 8, 2020 21:43
Pointers in C++
pointer var = address
* = &
int val = 10;
int *p;
p = &val;
// *p is val p is pointing to
// p is address inside p
cmake_minimum_required(VERSION 2.8.4)
project(lotd)
find_package(PkgConfig REQUIRED)
pkg_search_module(EVENT REQUIRED libevent)
set(libname "config")
file(GLOB SRC
cmake_minimum_required(VERSION 2.8.12)
project(lotd)
add_definitions("-std=c++11")
set(libname "config")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
image: docker:stable
stages:
- build
- test
variables:
IMAGE: ${CI_REGISTRY}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
build:
N/W:
Network Know-How
Head first networking
It's not something I took into consideration because for the most part the emails were being delivered pretty reliably but I can see why it might be a problem so I just had to look into it since I'm one of the contributors for that project and what I found was that the queues are not reliable (RabbitMQ is a little more reliable) as messages can be lost and redis queue (RQ) does not have a way to automatically re-do it, the failed job is flagged and stored for a year and you will have to write code to handle the exception.
@Algogator
Algogator / cnn.py
Created October 24, 2019 03:34
CNN
class CNN(nn.Module):
def __init__(self, vocab_size, embedding_dim, n_filters, filter_sizes, output_dim,
dropout, pad_idx):
super().__init__()
self.embedding = nn.Embedding(vocab_size, embedding_dim, padding_idx = pad_idx)
self.conv_0 = nn.Parameter(torch.randn((1,
n_filters,