This file contains 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::time::{SystemTime, UNIX_EPOCH}; | |
const EPOCH: u64 = 1420070400000; | |
pub struct Id { | |
internal_worker: u128, | |
internal_process: u128, | |
increment: u128, | |
} |
This file contains 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 __future__ import annotations | |
import random | |
import string | |
import time | |
from base64 import b64encode as b64e | |
from base64 import b64decode as b64d | |
from datetime import datetime | |
__all__ = ( |
This file contains 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
//! # sieve to generate prime numbers without an upper limit | |
//! | |
//! this is very fast, especially when built with --release | |
//! | |
//! # example: | |
//! ``` | |
//! for i in s { | |
//! println!("{} ", i); | |
//! } | |
//! ``` |
This file contains 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
const crypto = require("crypto") | |
/** | |
* Password hasher | |
* used to prepare the passwords for super secure storage. | |
* | |
* this system is so secure (unless the SALTS and PEPPERS are *stolen*) that its safe to have weak passwords like password123 iloveu and so on. | |
* as 2 same passwords will (most *likely*) have a different hash | |
* | |
* # Notes: |
This file contains 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 __future__ import annotations | |
from typing import Any | |
from typing import Callable | |
from typing import Generic | |
from typing import Tuple | |
from typing import TypeVar | |
from typing import Union | |
from typing import overload |
This file contains 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
""" | |
1. Create a web crawler/scraper that uses socket connections (No Selenium) to gather links from webpages and add | |
them to a process queue. | |
2. The queue will be processed by P number of processes (However many cores on the machine). | |
3. Each process will use aiohttp (Async) with max T number of threads/tasks (Variable default: 100) to scrape from | |
the queue and add to the queue. | |
4. Store the title of all scraped HTML pages along with their URLs in an SQLITE database file. |
This file contains 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
"""recursively extract links and their titles from a web address | |
""" | |
from __future__ import annotations | |
import re | |
import asyncio as aio | |
import aiohttp | |
from aiohttp import ClientTimeout |
This file contains 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
"""Bloom Filter | |
A Bloom filter is a space-efficient probabilistic data structure, | |
conceived by Burton Howard Bloom in 1970, that is used to test whether | |
an element is a member of a set. False positive matches are possible, | |
but false negatives are not – in other words, a query returns either | |
"possibly in set" or "definitely not in set". Elements can be added to | |
the set, but not removed (though this can be addressed with the counting | |
Bloom filter variant); the more items added, the larger the probability | |
of false positives. |
This file contains 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
#include <iostream> | |
using namespace std; | |
// create a 'kernel'. a kernel is a function that runs on the 'device' - GPU | |
__global__ | |
void saxpy(int n, float a, float* x, float* y) | |
{ | |
// get the current index in the arrays; | |
int i = blockIdx.x * blockDim.x + threadIdx.x; |
This file contains 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
// check comments for where to find these headers | |
#include "../common/book.h" | |
#include "../common/cpu_bitmap.h" | |
#define DIM 1000 | |
#define SCALE 0.1f | |
#define STEPS 300 | |
#define JULIA_REAL (-0.8f) | |
#define JULIA_IMAG (0.155f) |
OlderNewer