Skip to content

Instantly share code, notes, and snippets.

View ardani's full-sized avatar
🎯
Focusing

Ardani Rohman ardani

🎯
Focusing
View GitHub Profile
@ardani
ardani / api.example.conf
Created April 27, 2021 11:01 — forked from sky93/api.example.conf
Map Laravel /api route to api subdomain in Nginx
server {
listen 80;
server_name api.example.com;
location / {
root /usr/share/nginx/LARAVEL_DIR/public;
index index.php;
try_files $uri $uri/ /index.php$is_args$args;
location ~ \.php$ {
@ardani
ardani / flow-error-icu4c-not-loaded.md
Created June 11, 2020 04:50 — forked from berkedel/flow-error-icu4c-not-loaded.md
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

How to solve dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

brew uninstall --ignore-dependencies node icu4c
brew install node
@ardani
ardani / progress_bar.php
Created July 29, 2019 05:30 — forked from mayconbordin/progress_bar.php
PHP CLI progress bar in 5 lines of code
<?php
function progress_bar($done, $total, $info="", $width=50) {
$perc = round(($done * 100) / $total);
$bar = round(($width * $perc) / 100);
return sprintf("%s%%[%s>%s]%s\r", $perc, str_repeat("=", $bar), str_repeat(" ", $width-$bar), $info);
}
@ardani
ardani / Install nginx + PHP 7.1 on CentOS 7
Last active October 23, 2018 03:10
CentOS 7, nginx, PHP 7.1 Configuration
Step by step installation guide for nginx + PHP 7.1 on CentOS 7
1. Add and enable Remi repos
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils
yum-config-manager --enable remi-php71
2. Install php 7.1 and required modules
yum install php71-php-fpm
@ardani
ardani / genymotionwithplay.txt
Created November 25, 2017 00:56 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@ardani
ardani / letsencrypt_2017.md
Created November 14, 2017 02:08 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

@ardani
ardani / kpk_dan_fpb.php
Created September 21, 2016 14:03 — forked from khaeransori/kpk_dan_fpb.php
Fungsi menghitung KPK dan FPB
<?php
//untuk menentukan FPB 2 bilangan maka panggil fungsi gcf(angka1, angka2);
function gcf($a, $b) {
return ( $b == 0 ) ? ($a):( gcf($b, $a % $b) );
}
//untuk menentukan KPK 2 bilangan maka panggil fungsi lcm(angka1, angka2);
function lcm($a, $b) {
return ( $a / gcf($a,$b) ) * $b;
}
echo "Soal Nomor 1-3. <br/>";
<?php
// Obviously, you would build up the request somewhere other than a route...
Route::get('/api', function()
{
$client = new \GuzzleHttp\Client();
$response = $client->get('http://path/to/api');
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
<?php
/**
* @author Ihsan Faisal
*/
class EscapeCommand
{
const ESC = "\x1B";
private $commands = "";