Skip to content

Instantly share code, notes, and snippets.

View wahyudibo's full-sized avatar

Wahyudi Wibowo wahyudibo

  • Yogyakarta, Indonesia
View GitHub Profile
@wahyudibo
wahyudibo / default.conf
Last active April 25, 2020 23:13
Install nginx, php 70 (with fpm), and mysql in Mac OS X
server {
listen 80;
server_name localhost;
root /Users/wahyudibo/Projects/mylabs/php/nginx;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
@wahyudibo
wahyudibo / backup.md
Created April 21, 2020 04:33
Things to backup when reinstalling Ubuntu OS
@wahyudibo
wahyudibo / memcached mac os.md
Last active March 9, 2020 17:27
Install memcached on Mac OS

lists all memcached related packages

brew search memcached

install memcached as well as memcached extension for PHP

brew install memcached brew install php70-memcached

start memcached daemon with 24MB on port 11211 (default)

memcached -d -m 24 -p 11211

@wahyudibo
wahyudibo / MySQL strict mode off.md
Last active February 11, 2019 15:40
Turn off mysql 5.7 strict mode

Turn off MySQL 5.7 Strict Mode Globally

  • Check mysql mode SELECT @@sql_mode;
  • Add this snippet to /etc/mysql/my.cnf or if you install mysql via homebrew (MAC OS), you need to copy my.cnf with cp $(brew --prefix mysql)/support-files/my-default.cnf /usr/local/etc/my.cnf
[mysqld]
# Default : STRICT_TRANS_TABLES,ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_mode = ""
  • Restart mysql
@wahyudibo
wahyudibo / Curl.php
Created October 21, 2017 10:04
Example of Curl and Multi Curl in PHP
<?php
namespace App\Library\Curl;
class Curl {
private static $cookies, $proxy, $verbose, $mobile;
public static function setCookie($cookie_name){
self::$cookies = (dirname(getcwd()) . '/storage/app/cookies/'. $cookie_name . '.txt');
@wahyudibo
wahyudibo / script.js
Last active November 19, 2018 23:18
How to handle Promise fail fast behavior. Credits goes to : https://nmaggioni.xyz/2016/10/13/Avoiding-Promise-all-fail-fast-behavior/
let p1 = new Promise((resolve, reject) => {
setTimeout(resolve, 1000, "Everything OK in Promise 1");
});
let p2 = new Promise((resolve, reject) => {
reject(new Error("Something went wrong in Promise 2!"));
});
let p3 = new Promise((resolve, reject) => {
setTimeout(resolve, 2000, "Everything OK in Promise 3");
});

Make a two-column list of your major likes and dislikes

Likes :

  • I like to try / discover new things, especially if it's related to my hobbies or interest such as programming, computer / console games, astronomy
  • I like to listen to people's story, make them laugh, or teach people things that's new to them
  • I like to try to solve puzzles or riddles or some problems in programming. Even if i'm not good at Math and often guess wrong, i still amaze with the solutions.

Dislikes :

@wahyudibo
wahyudibo / change server timezone.md
Created November 27, 2016 04:01
Change server timezone (Ubuntu)

dpkg-reconfigure tzdata

@wahyudibo
wahyudibo / Elasticsearch dynamic scripting.md
Last active November 24, 2016 15:42
Elasticsearch config for enable dynamic scripting

add this to end of elasticsearch.yml

script.inline: on
script.indexed: on
@wahyudibo
wahyudibo / mongodb cli.md
Last active November 14, 2016 08:01
I use this when following tutorial in https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4 to create mongo database on my project folder.
  1. cd /path/to/your/project
  2. mkdir data
  3. mongod --dbpath /path/to/your/project
  4. A bunch of text should appear, you will see "I NETWORK [initandlisten]" alot;
  5. type "mongo" and press enter
  6. MongoDB shell version: your-mongo-version connecting to: test should be appear in your console. If not, repeat from step 1
  7. Still in mongo console, type "use your-db-name"
  8. You should see "switched to db your-db-name"
  9. Now you can put 'mongodb://localhost/node_api' in your connection settings