跳转到帖子

墨香年少

Administrators
  • 帖子数

    309
  • 注册日期

  • 上次访问

  • 得奖次数

    18

墨香年少 发布的所有帖子

  1. .env配置: DATABASE_URL="mysql://root:123456@127.0.0.1:端口/数据库名称?serverVersion=5.7&charset=utf8" 创建数据库 php bin/console doctrine:database:create
  2. php composer.phar require php-amqplib/php-amqplib 使用消息队列
  3. php composer.phar require symfony/messenger 可以使用messenger
  4. php composer.phar require symfony/orm-pack 可以使用doctrine
  5. php composer.phar require symfony/maker-bundle --dev 可以使用如下命令: php bin/console make:controller DefaultController
  6. 文件默认放在:/usr/lib/systemd/system/messenger-worker.service 输入:systemctl enable messenger-worker.service命令后,会自动将文件放在系统服务目录下
  7. /lib/systemd/system/messenger-worker.service: [Unit] Description=Symfony messenger-consume %i [Service] ExecStart=php /web/sf.demo.xyz/api/bin/console messenger:consume amqp_email_notification --time-limit=3600 Restart=always RestartSec=30 [Install] WantedBy=default.target systemctl enable messenger-worker.service systemctl start messenger-worker.service systemctl status messenger-worker.service
  8. class crypto { /** * * @return type */ static public function create_encryption_key() { return base64_encode(sodium_crypto_secretbox_keygen()); } /** * Encrypt a message * * @param string $message - message to encrypt * @param string $key - encryption key created using create_encryption_key() * @return string */ static function encrypt($message, $key) { $key_decoded = base64_decode($key); $nonce = random_bytes( SODIUM_CRYPTO_SECRETBOX_NONCEBYTES ); $cipher = base64_encode( $nonce . sodium_crypto_secretbox( $message, $nonce, $key_decoded ) ); sodium_memzero($message); sodium_memzero($key_decoded); return $cipher; } /** * Decrypt a message * @param string $encrypted - message encrypted with safeEncrypt() * @param string $key - key used for encryption * @return string */ static function decrypt($encrypted, $key) { $decoded = base64_decode($encrypted); $key_decoded = base64_decode($key); if ($decoded === false) { throw new Exception('Decryption error : the encoding failed'); } if (mb_strlen($decoded, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) { throw new Exception('Decryption error : the message was truncated'); } $nonce = mb_substr($decoded, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); $ciphertext = mb_substr($decoded, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); $plain = sodium_crypto_secretbox_open( $ciphertext, $nonce, $key_decoded ); if ($plain === false) { throw new Exception('Decryption error : the message was tampered with in transit'); } sodium_memzero($ciphertext); sodium_memzero($key_decoded); return $plain; } } $key = crypto::create_encryption_key(); $string = 'Sri Lanka is a beautiful country !'; echo $enc = crypto::encrypt($string, $key); echo "<br />"; echo "<br />"; echo "<br />"; echo crypto::decrypt($enc, $key);
  9. wget https://getcomposer.org/download/2.6.5/composer.phar php composer.phar update php composer.phar require symfony/lock cp composer.phar /usr/local/bin/composer
  10. 1.update composer php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" 2.install symfony-cli wget https://get.symfony.com/cli/installer -O - | bash 3.Create New Symfony Applications using ui webapp: symfony new --webapp my_project just api application symfony new my_project 需要: 1.删除禁用函数:putenv\proc_open 2.配置git
  11. 管理员权限打开powershell Get-ItemProperty HKLM:\SYSTEM\CurrentControlSet\Enum\HID\*\*\Device` Parameters FlipFlopWheel -EA 0 | ForEach-Object { Set-ItemProperty $_.PSPath FlipFlopWheel 1 }
  12. 1.创建机器人 @BotFather /newbot - create a new bot 2.查看群组id 在群组发个消息后,打开:https://api.telegram.org/TOKEN/getUpdates 3.查看自己的信息 https://api.telegram.org/TOKEN/getMe 4.给群组或者个人发送消息 https://api.telegram.org/TOKEN/sendMessage?text=hello&chat_id=chat_id 5.注册回调 $url = 'https://api.telegram.org/' . token . '/setWebhook'; $data = [ 'url' => 'https://www.xxx.com/bot/callback', ]; $result = $this->curl_post($url, $data);
  13. 在react项目目录下,打开cmd,输入: openssl req -x509 -newkey rsa:2048 -keyout keytmp.pem -out cert.pem -days 365 第二步,输入: openssl rsa -in keytmp.pem -out key.pem 打开:package.json 修改: "start": "export HTTPS=true&&SSL_CRT_FILE=cert.pem&&SSL_KEY_FILE=key.pem react-scripts start", 然后cmd输入:set HTTPS=true&&yarn start 启动react ,chrome会提示证书无效,在chrome中导入证书到信任区域后,重新打开chrome,重新打开https://localhost:3000 此时证书正常!
  14. data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAIAAAAErfB6AAAGW0lEQVR4nO2dvW7cRhSFOcbChbu8QQKkMVwZTu86Td4kL5M2pSoBAgS42Xp7BZGKyIAQICqlwnClFFu5uDR/h3d+ybmXc75qZXN3Z+45HwFy17J5ur1sYvn7v3P0c4e8effBecwvP/7cPT5+/uo8/nT6FLSGjx9/cx7z69sfusc3j/86j///n7+C1rDE+59eRz/3Vak3HuIziOFAh4NewiewIT6FGBZrWLglfIrrQ4pIh+3fcgjc5UlXyKScojuQN0/BvIMDRpY8ctwl8hhMIHueItkHBIz8eKS5S+Q0mEAPeDbugVfAyIxHprtEfoMJdIJns044AkZOPJLdJdYymEA/eDbox2LAyIZHvrvEugYT6ArPql2xBIw8eLS4S2xhMIHe8KzUm1HAyIBHl7vEdgYT6BBP9g61AWPuPBrdJbY2mECfeDL2yRyvL7K8FmbNs727hDleX5R6b3jMk6VbGQzGfHnK+tMHDI/n7KBnSQZjpjwSnJkGLGFNKaBzEyINxhx55HhiD1jO+uJA/zqCDcbseKS5wQUsba2hoItNkMGYF49MH9wBy1y3P5X30svgymfkRLIDvqdoyXvwodqOOgKudi6eyO992GWS/P3wVNjXxYArnEUQWroec6tSy96WqKq7loCr2n8Euvod/3Ghrn3OqaTHo4Ar2XM0Gjud+pUdjXsesvtOtwHvfp+J6O1xnq/N6t0/seN+m9PDvfM4pXsLWsMS2rtrTg/3mAWxS48dBqvbTwN3v0N97QPGXIidebxosKI9dKC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D2IdcAQsdt2eoJdhl0mYF49AHxYDFrjWINBFIuZWJWbHI8oNS8Ci1hcB+jck/uNCzJFHiCejgIWsKRp0bk7qV3YwU57izrQBF19HIujZEnm+Nov58hT0xzzdXpZ67yyvg27xmKfbS8yaR7XHBQxGn3jy9qkPGHPnUerxpgajQzxrdGgaMDLgUefxRgajNzzr9cYeMPLgUeTx6gajKzxrd4ULGNnwqPB4RYPRD55t+uEOGDnxCPd4FYPRCZ4tO+EbMDLjEetxZoPRA57texAWMPLjEehxNoORPU+p7GMCRpY8ojzOYDDy5imb9yH6/ZArjxCPvwFY1bweNriFmgAAAABJRU5ErkJggg==
  15. 打开powershell,输入: [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") (New-Object System.Drawing.Text.InstalledFontCollection).Families
  16. windows下的字体名称点击不了,选中不了,如何复制
  17. git fetch --all && git reset --hard origin/master && git pull
  18. git fetch --all && git reset --hard origin/master && git pull
  19. git config --global credential.helper store git push origin 分支名
  20. Github从2021年8月14日开始就不支持用户密码输入了:remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. 在push之前输入: git config --global credential.helper store git push origin 分支名
  21. git rm -r --cached . git add -A git commit -m "update .gitignore"
  22. let a = {} undefined a {} JSON.stringify(a) === '{}' true
  23. php代码: <?php class Javas { static public $key = "a32f9c44xbx2018z"; public static function encrypt($input, $key) { $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB); $input = Javas::pkcs5_pad($input, $size); $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, ''); $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND); mcrypt_generic_init($td, $key, $iv); $data = mcrypt_generic($td, $input); mcrypt_generic_deinit($td); mcrypt_module_close($td); $data = base64_encode($data); return $data; } private static function pkcs5_pad ($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } public static function decrypt($sStr, $sKey) { $decrypted= mcrypt_decrypt( MCRYPT_RIJNDAEL_128, $sKey, base64_decode($sStr), MCRYPT_MODE_ECB ); $dec_s = strlen($decrypted); $padding = ord($decrypted[$dec_s-1]); $decrypted = substr($decrypted, 0, -$padding); return $decrypted; } } JAVA代码 package com.bluebirdme.mes.publicFun; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; public class AesSecurity { /** * 加密kEY值 */ public static String key="a32f9c44xbx2018z"; /** * 加密 * @param input * @param key * @return */ public static String encrypt(String input, String key){ byte[] crypted = null; try{ SecretKeySpec skey = new SecretKeySpec(key.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, skey); crypted = cipher.doFinal(input.getBytes()); }catch(Exception e){ System.out.println(e.toString()); } return new String(Base64.encodeBase64(crypted)); } /** * 解密 * @param input * @param key * @return */ public static String decrypt(String input, String key){ byte[] output = null; try{ SecretKeySpec skey = new SecretKeySpec(key.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, skey); output = cipher.doFinal(Base64.decodeBase64(input)); }catch(Exception e){ System.out.println(e.toString()); } return new String(output); } }
  24. 结果如下: [root@pc-2 centos]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 3.8G 0 3.8G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 17M 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 8.0G 847M 7.2G 11% / tmpfs 783M 0 783M 0% /run/user/1000 tmpfs 783M 0 783M 0% /run/user/0 /dev/sdb1 99G 61M 94G 1% /mnt [root@pc-2 centos]# 可以看到 99G 的 /dev/sdb1 挂载到了 /mnt
  25. 使用命令: lsblk -f 查看/mnt的uuid [root@pc-2 centos]# mount /dev/sdb1 /mnt [root@pc-2 centos]# lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT sda └─sda1 xfs 6cd50e51-cfc6-40b9-9ec5-f32fa2e4ff02 / sdb └─sdb1 ext4 aa335620-9fab-4e08-94e2-0c88ac426fbc /mnt sr0 iso9660 config-2 2023-08-27-14-39-24-00 [root@pc-2 centos]# /mnt的uuid是:a335620-9fab-4e08-94e2-0c88ac426fbc 设置开机挂载: vi /etc/fstab 在最下面增加: UUID=a335620-9fab-4e08-94e2-0c88ac426fbc /mnt ext4 defaults 0 0 注意:uuid不要复制错了,上面的uuid少复制了一位,导致重启后无法启动,会提示root account被禁用
×
×
  • 创建新的...

重要信息

注册必须使用2-8个中文汉字作为账号