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
import { createWriteStream, existsSync, mkdirSync } from "fs"; | |
import { join } from "path"; | |
import { pipeline } from "stream/promises"; | |
/** | |
* To get `qari_dir`: | |
* 1. Go to https://quranicaudio.com | |
* 2. Choose qari | |
* 3. Hover to the download button, you will see the download link contains qari directory | |
* |
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 total = 1_000; | |
const limit = 40; | |
const messages = []; | |
let ok = 0; | |
let fail = 0; | |
async function send() { | |
try { | |
// copy from chrome dev-tools |
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
import type { CustomTypesConfig, QueryConfig } from 'pg'; | |
export class Template_Query_Config implements QueryConfig { | |
private name_?: string; | |
private types_?: CustomTypesConfig; | |
constructor(private readonly strings: string[], readonly values: any[]) {} | |
get text(): string { | |
return ( |
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
/** | |
* Find valid Telegram Group invite link. | |
* This is a challenge from my friend. | |
*/ | |
const config = { | |
url: 'https://t.me/+zUufcmk***E3nGQ1', // asterisks are hidden chars | |
name: 'Mine', // name of group | |
process_count: 100, // how many process should run at a time | |
}; |
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
import { spawn } from "child_process"; | |
import { readdirSync } from "fs"; | |
import path from "path"; | |
class AudioPlayer { | |
constructor({ player, folder, ext = "wav" }) { | |
if (!player || !folder) throw new Error(`Parameters 'player' and 'folder' are required`) | |
this.player = player; | |
this.folder = path.resolve(folder); | |
this.ext = `.${ext}`; |
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
import java.lang.reflect.Array; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import javax.swing.*; | |
import javax.swing.table.DefaultTableModel; |
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
class Bicycle { | |
int cadence; | |
int _speed = 0; // Private | |
int gear; | |
Bicycle(this.cadence, this.gear); | |
int get speed => _speed; // Getter | |
void applyBreake(int dec) { |
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
function fish_prompt --description 'Write out the prompt' | |
set -l last_status $status | |
set -l _ob (set_color yellow)'{ '(set_color normal) | |
set -l _cb (set_color yellow)' }'(set_color normal) | |
set -l _c1 "┏┈$_ob" | |
# User | |
set -l _usr (set_color cyan)'usr: '(set_color green)'\'hm\''(set_color normal)', ' |
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
// Generate random GUID | |
function guid() { | |
const rand = () => Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); | |
let res = rand(); | |
for (let i = 0; i < 11; i++) { | |
i % 2 && i <= 7 ? (res += '-') : (res += rand()); | |
} | |
return res; | |
} |
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
import java.beans.IntrospectionException; | |
import java.beans.PropertyDescriptor; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import java.util.List; | |
import javax.swing.table.AbstractTableModel; | |
/** | |
* @param <T> entity class |