Skip to content

Instantly share code, notes, and snippets.

View daopk's full-sized avatar
🐘

Phan Khắc Đạo daopk

🐘
View GitHub Profile
@daopk
daopk / ubuntu_wsl2_setup.sh
Last active September 26, 2023 04:02
My script for quickly setting up my development environment in WSL2 Ubuntu
#!/bin/bash
# Update and upgrade packages
sudo apt-get update
sudo apt-get upgrade -y
# Install Homebrew
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH
@daopk
daopk / disable-selinux-on-centos.md
Last active August 22, 2020 18:03
Disable SELinux on CentOS 7+

Fix nginx proxy PHP-FPM Permission denied

[error] 14066#0: *168 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0Unable to open primary script: index.php (Permission denied)" while reading response header from upstream, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock:"

Steps:

  1. Open the /etc/selinux/config file and set the SELINUX mod to disabled
  2. Save the file and reboot your CentOS system
  3. Check status
@daopk
daopk / git-config-http-version.md
Last active May 2, 2024 01:38
Fix error : RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
git config --global http.version HTTP/1.1
git config --global http.postBuffer 157286400
@daopk
daopk / post-receive
Last active August 22, 2020 18:04
Git hooks post-receive with auto install node modules
#!/bin/bash
TRAGET="/path/to/your/website/folder"
GIT_DIR="/path/to/your/git/repo.git"
BRANCH="master"
while read oldrev newrev ref
do
# only checking out the master (or whatever branch you would like to deploy)
if [[ $ref = refs/heads/$BRANCH ]];
then
@daopk
daopk / rc4.php
Last active November 12, 2019 05:04
rc4 algorithm in php
<?php
class RC4
{
public static $_key = 'aRand0mStr1ng';
public static function encode($string, $key = null)
{
$res = self::_rc4($string, $key);
$encrypted = unpack('H*', $res);
int width = 500;
int height = 200;
int lineWidth = 10;
int lineLength = 1000;
int startX = 0;
int startY = 0;
Snake snake;