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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <stdbool.h> | |
// Function to generate a random password | |
void generateRandomPassword(int length, bool includeSymbols) { | |
const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+{}[]<>,.?/"; // Characters to choose from | |
int charsetSize = sizeof(charset) - 1; |
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 tarfile | |
import os | |
import pdfkit | |
# Get the archive file at https://www.php.net/distributions/manual/php_manual_en.tar.gz | |
# Install pdfkit: https://github.com/JazzCore/python-pdfkit | |
def decompress_tar_file(file_name): | |
tar = tarfile.open(file_name) | |
tar.extractall() |
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
'use strict'; | |
/* | |
https://www.youtube.com/watch?v=gllUwQnYVww | |
Emulating switch/case Statements in Python with Dictionaries | |
*/ | |
const execFunc = (operand = 'add', a = 1, b = 1) => { | |
const getOperand = (name, obj) => { | |
if(typeof obj[name] !== 'function') { |
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
from CloudflareRequest import CloudflareRequest | |
from CloudflareDNS import CloudflareDNS | |
class Cloudflare: | |
def __init__(self, host): | |
self.host = host | |
self.url = 'https://' + self.host | |
self.request = CloudflareRequest(self.url) | |
self.dns = CloudflareDNS(self.host) | |
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 requests | |
import validators | |
from validators import ValidationFailure | |
class CloudflareDNS: | |
def __init__(self, host): | |
self.host = host | |
self.record = 'NS' | |
self.api_url = 'https://dns.google/resolve?' | |
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 requests | |
import validators | |
from validators import ValidationFailure | |
class CloudflareRequest: | |
def __init__(self, url): | |
self.url = url | |
def send(self): |
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
<?php | |
// Never ever use the wp hook to run unnecessary routines | |
// Global overhead ahead! | |
function my_factorial( $n ) { | |
if( function_exists( 'gmp_fact' ) ) { | |
return gmp_fact( $n ); | |
} else { | |
if ( $n < 2 ) { | |
return 1; |
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
"use strict"; | |
(function() { | |
const isPrimeNumber = number => { | |
if ( number == 1 || number == 2 ) { | |
return true; | |
} | |
for ( var i = 2; i < number; i++ ) { | |
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
/* | |
* Scrivere un programma che legge in ingresso un numero intero non | |
* negativo a, e stampa sullo schermo tutti i numeri primi compresi | |
* tra 0 ed a. Realizzare il programma definendo ed utilizzando | |
* almeno le due funzioni seguenti. | |
* | |
* Una funzione che, dato un numero intero passato come parametro, | |
* ritona true se il numero e' primo, false altrimenti. | |
* | |
* Una funzione che, dato un numero intero n passato come parametro, |
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
'use strict'; | |
module.exports = { | |
paypal: { | |
businessEmail: 'your-paypal-business-email', | |
url: 'https://www.sandbox.paypal.com/cgi-bin/webscr', | |
currency: 'USD' | |
}, | |
secret: 'secret-session-key', | |
name: 'name-of-session-cookie', |
NewerOlder