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
/** | |
* Return an environment variable typed value from `process.env`. | |
* It also supports a default value in case of `undefined`. | |
* | |
* The function will follow these steps to take a typed value: | |
* 1. First it will try to get the env value from `process.env`. | |
* 2. Then if `undefined` then it try with the default environment variable value if defined. | |
* 3. Otherwise if the default value is `undefined` then it will return the Javascript default values: | |
* - Boolean: `false` | |
* - String: `""` |
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
# Match on all types of devices but joysticks | |
# | |
# If you want to configure your devices, do not copy this file. | |
# Instead, use a config snippet that contains something like this: | |
# | |
# Section "InputClass" | |
# Identifier "something or other" | |
# MatchDriver "libinput" | |
# | |
# MatchIsTouchpad "on" |
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
enum Token { | |
Start, | |
Middle, | |
End, | |
} | |
/// Parses the Nginx-like `try_files` directive string and returns a vector of tokens. | |
pub fn parse(val: &str) -> Vec<String> { | |
let mut kind = Token::Start; | |
let mut token = String::new(); |
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
/** Representa una respuesta JSON satisfactoria */ | |
interface ResponseOk<T = null> { | |
success: true | |
data: T | |
} | |
/** Representa una respuesta JSON errónea */ | |
interface ResponseFail<T = null> { | |
success: false | |
code: string|number |
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 secure random string values in Javascript using cryto-random bytes */ | |
function randomHash (len) { | |
return Array.from( | |
window.crypto.getRandomValues(new Uint8Array(Math.ceil(len / 2))), | |
(b) => ("0" + (b & 0xFF).toString(16)).slice(-2) | |
).join("") | |
} | |
// Simple tests with various lengths |
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 futures::StreamExt; | |
use std::error::Error; | |
use tokio; | |
use tokio::macros::support::Pin; | |
use tokio::prelude::*; | |
use tokio::time::{Duration, Instant}; | |
pub fn main() -> Result<(), Box<dyn std::error::Error>> { | |
let mut multi_threaded_runtime = tokio::runtime::Builder::new() | |
.threaded_scheduler() |
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
/** | |
* DISCLAIMER: | |
* The only intention of this "scraper script" is to serving as a backup tool for YOUR own content on Quora. | |
* Which means YOUR PUBLIC/PRIVATE content with YOU as author. | |
* So use this script under Quora Policy and Term conditions. https://www.quora.com/about/tos_archive | |
**/ | |
/** | |
* Dead simple Javascript browser scraper to backing up YOUR Quora content. | |
* Feel free to customize it to your needs. |