If you want to be a respectable PHP programmer in this age, make sure you know about a few important things!
Familiarize yourself with PSR standards. The most important one is PSR-0 as it changed the way PHP is coded in version 5.3.
If you want to be a respectable PHP programmer in this age, make sure you know about a few important things!
Familiarize yourself with PSR standards. The most important one is PSR-0 as it changed the way PHP is coded in version 5.3.
This issue is noted here: https://deliciousbrains.com/wp-migrate-db-pro/doc/ssl-errors/
Original reference for this fix is from: http://stackoverflow.com/questions/26461966/osx-10-10-curl-post-to-https-url-gives-sslread-error/26538127#26538127
php -i | grep "SSL Version"
<?php namespace Foo; | |
// app/Myapp.php | |
use Monolog\Logger; | |
use Laravel\Lumen\Application; | |
use Monolog\Handler\StreamHandler; | |
use Monolog\Formatter\LineFormatter; | |
use Monolog\Handler\NewRelicHandler; | |
class Myapp extends Application |
Quick tip for handling CSRF Token Expiration - common issue is when you use csrf protection is that if | |
a form sits there for a while (like a login form, but any the same) the csrf token in the form will | |
expire & throw a strange error. | |
Handling it is simple, and is a good lesson for dealing with other types of errors in a custom manner. | |
In Middleware you will see a file VerifyCsrfToken.php and be tempted to handle things there. DON'T! | |
Instead, look at your app/Exceptions/Handler.php, at the render($request, Exception $e) function. | |
All of your exceptions go through here, unless you have excluded them in the $dontReport array at the |
def verify_sign(public_key_loc, signature, data): | |
''' | |
Verifies with a public key from whom the data came that it was indeed | |
signed by their private key | |
param: public_key_loc Path to public key | |
param: signature String signature to be verified | |
return: Boolean. True if the signature is valid; False otherwise. | |
''' | |
from Crypto.PublicKey import RSA | |
from Crypto.Signature import PKCS1_v1_5 |
对于mTLS的配置的证书来说,有如下的提示。
三个文件。 对于大多数系统,如:MySQL, Redis,PostgreSQL。会需要三个文件:CA证书 + CERT 和 KEY。可以在我的这个开源项目(https://github.com/haoel/mTLS/tree/main/certs )中找到我生成的CA,以及 Server 和 Client的 .crt
和 .key
文件。生成的方法也在我的那个开源项目中了。
两个文件。 对于有的系统,比如:MongoDB,他只要两个文件,一个是CA,一个是 pem 文件,对于pem文件,你可以直接把上面的 .crt 和 .key 合并了就好了。如:cat server.crt server.key > server.pem
JKS文件。 对于一些系统,比如:Kafka 和 Zookeeper。他要的不是上面的明文的格式,他要的是一种jks的格式,这是Java的格式。怎么从上面的明文的方式转到jks的文件。需要经过下面几步。
This snippet is about cross-platform AES-GCM-256 encryption & decryption, Where payload is being encrypted using JAVA and decrypted using NODE
sample config :
{
"masterKey": "sfcpnnjFG6dULJfo1BEGqczpfN0SmwZ6bgKO5FcDRfI=",
"iterations": 2333,
"keyLength": 32,
"digest": "sha512"
#!/usr/bin/env bash | |
# Download metadata, modify these as your needs. | |
## The directory to save the downloaded files. | |
download_directory="/volume1/Download/EPUB" | |
## The website you want to visit. | |
calibre_site="http://soulseeker.myds.me:25788" | |
## The formats you want to download. We only download the first present format. | |
## All the formats should be upper case. | |
allow_formats=( EPUB MOBI AZW3 ) |
/** | |
* Convert From/To Binary/Decimal/Hexadecimal in JavaScript | |
* https://gist.github.com/faisalman | |
* | |
* Copyright 2012-2015, Faisalman <fyzlman@gmail.com> | |
* Licensed under The MIT License | |
* http://www.opensource.org/licenses/mit-license | |
*/ | |
(function(){ |
/* | |
* The `DateTime` constructor doesn't create objects with fractional seconds. | |
* However, the static method `DateTime::createFromFormat()` does include the | |
* fractional seconds in the object. Finally, since ISO 8601 specifies only | |
* millisecond precision, remove the last three decimal places from the timestamp. | |
*/ | |
// DateTime object with microseconds | |
$now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', '')); |