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
| #!/usr/bin/env python3 | |
| import subprocess | |
| import json | |
| import re | |
| import sys | |
| from typing import Optional, Dict, List | |
| import argparse | |
| try: |
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 os | |
| import requests | |
| from requests.auth import HTTPBasicAuth | |
| import argparse | |
| import sys | |
| from concurrent.futures import ThreadPoolExecutor, as_completed | |
| from time import sleep | |
| import logging | |
| requests.packages.urllib3.disable_warnings() |
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
| [ | |
| { | |
| "timestamp": "2024-06-08T12:45:00Z", | |
| "level": "INFO", | |
| "service": "auth", | |
| "message": "User login successful", | |
| "userId": "user123", | |
| "ipAddress": "192.168.1.10" | |
| }, | |
| { |
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 users = [ | |
| { name: "Alice", age: 25 }, | |
| { name: "Bob", age: 30 }, | |
| { name: "Charlie", age: 35 } | |
| ]; | |
| const names = users.reduce((acc, {name}) => acc.concat(name), []); | |
| console.log(names); | |
| // Output: ["Alice", "Bob", "Charlie"] |
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 users = [ | |
| { name: "Alice", age: 25 }, | |
| { name: "Bob", age: 30 }, | |
| { name: "Charlie", age: 35 } | |
| ]; | |
| const names = users.map(user => user.name); | |
| console.log(names); | |
| // Output: ["Alice", "Bob", "Charlie"] |
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
| BEGIN ISOLATION LEVEL SERIALIZABLE; | |
| SELECT * FROM users; | |
| COMMIT; |
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 https = require('https'); | |
| const fs = require('fs'); | |
| const options = { | |
| key: fs.readFileSync('path/to/private.key'), | |
| cert: fs.readFileSync('path/to/certificate.crt') | |
| }; | |
| https.createServer(options, (req, res) => { | |
| res.writeHead(200); |
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 Redis = require("ioredis"); | |
| const redis = new Redis(); | |
| app.get("/top-articles", async (req, res) => { | |
| const articles = await redis.zrevrange("articles", 0, 10); | |
| res.send(articles.map(JSON.parse)); | |
| }); |
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 Redis = require("ioredis"); | |
| const redis = new Redis(); | |
| app.post("/add-article", async (req, res) => { | |
| const article = req.body; | |
| await redis.zadd("articles", article.score, JSON.stringify(article)); | |
| res.send("Article added!"); | |
| }); |
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 Redis = require("ioredis"); | |
| const redis = new Redis(); | |
| app.get("/receive", async (req, res) => { | |
| const message = await redis.lpop("messages"); | |
| res.send(`Received message: ${message}`); | |
| }); |
NewerOlder