Skip to content

Instantly share code, notes, and snippets.

View dyazincahya's full-sized avatar
🔥
plus ultra

Kang Cahya dyazincahya

🔥
plus ultra
View GitHub Profile
@dyazincahya
dyazincahya / in_array_r.php
Last active August 27, 2018 07:18
PHP Function in_array multidimension
<?php
function in_array_r($thekey, $arraydata, $strict = false)
{
foreach ($arraydata as $item)
{
if (($strict ? $item === $thekey : $item == $thekey) || (is_array($item) && in_array_r($thekey, $item, $strict)['found']))
{
return array(
"found" => true,
"data" => $item
@dyazincahya
dyazincahya / downloadFile.js
Last active August 7, 2019 04:52
Function to download files to local in nativescript 4.x
const fs = require('file-system');
const httpModule = require("http");
exports.download = function (args) {
let data = args.object;
context.set("xLoading", { "status": true, "text": "Downloading..." });
// path download path directory in storage
var androidDownloadsPath = android.os.Environment.getExternalStoragePublicDirectory(android.os.Environment.DIRECTORY_DOWNLOADS).toString();
@dyazincahya
dyazincahya / strarr_to_arr.php
Created October 19, 2018 09:04
Function php string array to real array
<?php
// function
function strarr_to_array($a, $t = ''){
$arr = [];
$a = ltrim($a, '[');
$a = ltrim($a, 'array(');
$a = rtrim($a, ']');
$a = rtrim($a, ')');
$tmpArr = explode(",", $a);
foreach ($tmpArr as $v) {
@dyazincahya
dyazincahya / install_phpexcel_php7.sh
Created October 22, 2018 09:09 — forked from belgattitude/install_phpexcel_php7.sh
Install libxl, php_excel extension on PHP7.1 (ondrej/ppa)
#!/bin/bash
#
# ilia/php_excel extension example install script for PHP7+
#
# usage:
# > sudo ./install_phpexcel_php7.sh
# > (optionally) sudo service php7.1-fpm restart)
#
# requirements:
# - Ubuntu 64bits (trusty/xenial)
#!/bin/bash
#
# Example script to install LibXL, ilia/php_excel on PHP 7.2 (ondrej/ppa)
#
# Usage:
# > sudo ./install_phpexcel_php72.sh
# > sudo service php7.2-fpm reload (if using fpm)
#
# Requirements:
# - Tested with Ubuntu 64bits (14.04, 16.04+)
#!/bin/bash
# @author : kang cahya
# @github : https://github.com/dyazincahya
# ##########################################
# ###################################################################################################
# requirements:
# - REDHAT 6.x
# - sudo access
#
org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':app:compileDebugKotlin'.
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:145)
at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:115)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:78)
at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:75)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:75)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:62)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuil
@dyazincahya
dyazincahya / ffmpeg.md
Last active February 11, 2019 11:17 — forked from alexellis/timelapse.md
Create timelapse and add watermark with ffmpeg

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

my ex : ffmpeg -r 24 -pattern_type glob -i '*.JPG' -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution
@dyazincahya
dyazincahya / gist:ca5e4a9d2c55a60ca5a96caf42c4a33b
Created April 4, 2019 03:25 — forked from tonyspiro/gist:490962be30a67af923de
Curl Get, Post, Put and Delete in PHP
<?php
class Curl {
public function get($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],