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 { hash } from 'bun'; | |
import { sql } from './db'; | |
import type { Nullable } from './types'; | |
export const LOCKS_TABLE = 'locks'; | |
const DEFAULT_LOCK_TIMEOUT = 60 * 1000; // 1 minute | |
let tableSetupDone = false; | |
type LockOptions = { | |
timeout?: number; |
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
fn main() { | |
let args: Vec<_> = std::env::args().collect(); | |
if args.len() < 4 { | |
eprintln!("You must enter the alphabet and the sequence size"); | |
return; | |
} | |
let alphabet = &args[2]; | |
let count = args[3] |
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 ( | |
"flag" | |
"fmt" | |
"io" | |
"math" | |
"os" | |
"strings" | |
"time" |
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
const crypto = require('crypto') | |
function getSecureFloat() { | |
// Generate 7 random bytes | |
const bytes = crypto.randomBytes(7); | |
// Shift 5 bits from first bytes by 5 to the right | |
let randomValue = (bytes[0] % (2 ** 5)) / (2 ** 5); | |
// For each of the following 6 bytes, add its value and shift it 8 bits to the right |