Skip to content

Instantly share code, notes, and snippets.

View rizalp's full-sized avatar

Mohammad Shahrizal Prabowo rizalp

View GitHub Profile
@rizalp
rizalp / debug-symfony-phpstorm.md
Last active November 5, 2021 03:57
[Debugging Symfony Controller Using PHPStorm] step by step guide on how to do debugging on PHPStorm using Xdebug #symfony #xdebug #phpstorm #php

Debugging Symfony Controller Using PHPStorm

In order to debug symfony or php apps that uses front end controller approach, you need to have several things:

  • Configure Xdebug. I prefer to use the On-Demand mode, but beware that it's only applicable to cli scripts / code coverage reports. Make sure that you set the xdebug.mode=debug and xdebug.idekey=PHPSTORM. This will be usefull in case you need to Debugging Symfony commands.

debug-symfony-phpstorm-1

  • To debug incoming http request, you need to have a webserver running configuration. We'll use the PHP Built-in Web Server as it's sufficient for our purpose. Click Run > Edit Configurations > Add New Configuration > PHP Built-in We
@rizalp
rizalp / sqlite3-notes.md
Last active March 21, 2023 12:22
[Building Sqlite3] Building latest Sqlite3 & Sqlitebrowser #sqlite3 #sqlitebrowser #ubuntu22.04

SQLite 3 Notes

Some notes when working with SQLite 3

SQLite 3 Compile Time Options And Pragma

SQLite has multiple build flag and pragmas that can be used to enable / disable certain functionality. Due to this, it's important to remember if certain functionality exist on your target servers

@rizalp
rizalp / phpbuild.md
Last active March 21, 2023 11:23
[Build PHP 8] Minimal Build PHP 8.2.4, linked with sqlite3 from source on Ubuntu 22.04 And Macos #php #sqlite3 #ubuntu22.04
@rizalp
rizalp / mysql2 gem with mysql 5.7 brew
Last active August 10, 2023 02:58
install mysql2 gem by linking it with mysql 5.7 homebrew
brew install mysql@5.7
gem install mysql2 -v '0.4.8' -- --with-ldflags=-L/usr/local/opt/mysql@5.7/lib --with-cppflags=-I/usr/local/opt/mysql@5.7/include
@rizalp
rizalp / disable_spectre.md
Last active May 22, 2023 22:07
Disable Spectre/Meltdown Mitigation

In /etc/default/grub, modify:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off tsx=on tsx_async_abort=off mitigations=off"

Then sudo update-grub

@rizalp
rizalp / mojave-rails-jemalloc-gmp.md
Last active October 23, 2021 08:02
macOs Mojave Rails Setup with jemalloc and gmp

Homebrew install

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install Libraries

brew install rbenv ruby-build sqlite3 jemalloc gmp
@rizalp
rizalp / zram-ubuntu-1804.md
Last active October 22, 2023 12:06
Zram Ubuntu 1804
  • sudo apt install zram-config, this will install several files, including systemd startup /etc/systemd/system/multi-user.target.wants/zram-config.service
  • sudo nano /usr/bin/init-zram-swapping and edit:
#!/bin/sh

# load dependency modules
NRDEVICES=1
if modinfo zram | grep -q ' zram_num_devices:' 2>/dev/null; then
 MODPROBE_ARGS="zram_num_devices=${NRDEVICES}"
@rizalp
rizalp / DeepCopy.js
Last active December 28, 2015 07:59
How to do deep copy to Javascript object, and call the parent's own prototype method
/* Title: Deep Copy Object Properties
* Refference: https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/inheritance-by-copying-properties.html
* Description: an object gets functionality from another object, simply by copying it
* Only the properties will be copied. The prototype will not
* it is generally not recomended to copy the prototype over
*/
/* deep copy */
function extendDeep(parent, child) {
var i, toStr = Object.prototype.toString,
@rizalp
rizalp / child.js
Last active December 23, 2015 06:09
//this works encapsulating private properties
//now, how about prototypes?
var Child = (function (s, f){
var DOB = new Date();
var sex = s;
var fullName = f;
var mood;
return {