Skip to content

Instantly share code, notes, and snippets.

View zhiephie's full-sized avatar
:octocat:
Focusing

Yudi Purwanto zhiephie

:octocat:
Focusing
View GitHub Profile
@zhiephie
zhiephie / console.js
Created July 21, 2024 08:24
Delete all Google Photos from console
const maxCount = 500;
const counterSelector = '.rtExYb';
const checkboxSelector = '.ckGgle[aria-checked=false]';
const photoDivSelector = ".yDSiEe.uGCjIb.zcLWac.eejsDc.TWmIyd";
const deleteButtonSelector = 'button[aria-label="Hapus"]';
const confirmationButtonSelector = "#yDmH0d > div.VfPpkd-Sx9Kwc.cC1eCc.UDxLd.PzCPDd.V639qd.oEOLpc.A9Uzve.VfPpkd-Sx9Kwc-OWXEXe-FNFY6c > div.VfPpkd-wzTsW.O4g5Md.iWO5td > div > div.VfPpkd-cnG4Wd.m5OsGf > div > div.VfPpkd-T0kwCb.IdSMxc > button.VfPpkd-LgbsSe.VfPpkd-LgbsSe-OWXEXe-k8QpJ.nCP5yc.AjY5Oe.LQeN7.kDryjd";
async function deleteGooglePhotos() {
// Retrieves the current count of selected photos
const getCount = () => {
@zhiephie
zhiephie / in.js
Last active August 16, 2023 05:08
Performance Increase using Dynamic SQL Generation
// Expand your date range to an array
const dates = [
'2023-08-01',
'2023-08-02',
'2023-08-03',
'2023-08-04'
]
// Define the static part of your query
let query = `SELECT hotelRoomId, MIN(price)
@zhiephie
zhiephie / php-pools.md
Created September 5, 2022 16:14 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@zhiephie
zhiephie / apiCall.js
Last active August 25, 2022 06:55
Api Call using fecth
export function apiCall(route, body = {}, method = 'POST') {
const request = new Promise((resolve, reject) => {
const headers = new Headers({
'Content-Type': 'application/json',
});
const requestDetails = {
method,
mode: 'cors',
headers,
@zhiephie
zhiephie / mysql-docker.sh
Created August 1, 2022 02:56 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@zhiephie
zhiephie / Test Driven Laravel.md
Created February 15, 2022 11:03 — forked from Pen-y-Fan/Test Driven Laravel.md
Test Driven Laravel

Learning Plan for Test Driven Development (TDD)

These learning resources primarily focus on Test Driven Development (TDD).

  • There is an emphasis on learning using PHP, Laravel and PHPUnit.
  • All these resources are free (at the time of writing)

Learning Plan for Design Patterns and Principles of Good Design

These learning resources primarily focus on programming using Good Design Principles and Design Patterns

  • There is an emphasis on learning using PHP, although most patterns are universal to every object orientated language.
@zhiephie
zhiephie / Designing Event-Driven Systems links.md
Created January 26, 2022 04:56 — forked from giampaolotrapasso/Designing Event-Driven Systems links.md
List of links from Designing Event-Driven Systems by Ben Stopford
@zhiephie
zhiephie / semantic-commit-messages.md
Created November 9, 2021 09:53 — forked from joshbuchea/semantic-commit-messages.md
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example