Skip to content

Instantly share code, notes, and snippets.

View khoimm92's full-sized avatar
🏠
Working from home

Khoi Ngo khoimm92

🏠
Working from home
View GitHub Profile
@khoimm92
khoimm92 / curl.md
Created February 14, 2019 07:05 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo sysctl vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl vm.vfs_cache_pressure=50
@khoimm92
khoimm92 / fetch_bitbucket_repositories.sh
Last active February 10, 2020 03:52
Fetch all Bitbucket repositories link to satis.json using JQ
USER="bitbucket_username";
REPOUSER="bitbucket_password";
SATISFILEPATH="./satis.json";
PAGE=1;
PAGESIZE=100;
REPO=''; // string, repositories data
getrepo() {
response="$(curl -u ${USER} https://api.bitbucket.org/2.0/repositories/${REPOUSER}?pagelen=${PAGESIZE}"&page=${PAGE}" > temp.json)"
repotem="$(cat temp.json | jq -r '.values[].links.clone[] | select(.name=="https") | "{\"type\": \"git\", \"url\": " + "\""+ .href + "\" },"')";
@khoimm92
khoimm92 / product.liquid
Created September 3, 2020 11:15 — forked from resistorsoftware/product.liquid
You Might Like This! Shopify Related Products App
<!--
* a simple HTML DOM element for rendering related products.
* Style with CSS to make the <ul> look like whatever you want.
* place this snippet in your product.liquid where you would like the related products to appear
-->
<div id="related-products-container">
<h1>YOU MIGHT LIKE THIS!</h1>
<div id="related">
<ul class="related">
@khoimm92
khoimm92 / gist:953d54160e257d9c34225cb6764032c5
Last active November 6, 2020 12:33
File: vendor/magento/zendframework1/library/Zend/Http/Response.php. The changes in line 185 and 519
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
@khoimm92
khoimm92 / README.md
Created April 17, 2021 04:26 — forked from e-cloud/README.md
Install mysql 8.0 on wsl
wget -c "https://gist.github.com/e-cloud/34acbefe0597a02f9a081a01eff6dd24/raw/3bad7148f60ab70659b0be14ef07b0bd4d019f62/install-mysql8-on-wsl.sh" install-mysql8-on-wsl.sh
chmod 740 install-mysql8-on-wsl.sh
./install-mysql8-on-wsl.sh
@khoimm92
khoimm92 / MDVA-25602_EE_2.2.3.composer.patch
Last active May 14, 2021 08:02
Patch for PayflowPro Checkout Issue https://github.com/magento/magento2/issues/26840. For M2.3.2 version
diff --git a/vendor/magento/module-payment/Block/Transparent/Redirect.php b/vendor/magento/module-payment/Block/Transparent/Redirect.php
new file mode 100644
index 00000000000..aeaeee7e4d2
--- /dev/null
+++ b/vendor/magento/module-payment/Block/Transparent/Redirect.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
@khoimm92
khoimm92 / my.ini
Last active June 2, 2021 13:12
MySQL config increase perfomance on XAMPP
# My note: have a look at '# Custom' sections
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# You can copy this file to
# C:/xampp/mysql/bin/my.cnf to set global options,
@khoimm92
khoimm92 / mysql8_create_db_user
Last active August 10, 2021 13:23
MySQL 8 - create user
# create a user
mysql> CREATE USER 'khoai'@'%' IDENTIFIED BY 'khoai';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'khoai'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
# set policy
SET GLOBAL validate_password.LENGTH = 4;
SET GLOBAL validate_password.policy = 0;
SET GLOBAL validate_password.mixed_case_count = 0;
SET GLOBAL validate_password.number_count = 0;
@khoimm92
khoimm92 / 2019-https-localhost.md
Created August 7, 2021 11:03 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).