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
| ## Pinging Telegram from Terminal | |
| 1. Create a bot | |
| - In Telegram, chat with @BotFather → ```/newbot``` → copy the returned *HTTP API token*. | |
| 2. Find your chat ID (where the message should arrive) | |
| - Send any message to your new bot. | |
| - From a terminal run: | |
| ```bash | |
| curl -s "https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates" |
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 |