Skip to content

Instantly share code, notes, and snippets.

View indrakaw's full-sized avatar
🎯
Focusing

Indra Kurniawan indrakaw

🎯
Focusing
  • Slow Code, co.
  • Cirebon, Indonesia
View GitHub Profile
#!/usr/bin/env ruby
# You have to install "vagrant-vbguest" to get it works
# $ vagrant plugin install vagrant-vbguest
VAGRANTFILE_API_VERSION = '2'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "debian/stretch64"
config.vm.network "private_network", ip: "192.168.33.230"
@indrakaw
indrakaw / git_helper.php
Last active June 20, 2019 03:08
A collection of function for git hash checking in PHP. Pure PHP, no command exec() required.
<?php
/**
* Git Helper
*
* This file contains set of functions that returns git's metadata.
* It doesn't perform git operation; read then pharse only.
*
* LIMITATION: this function only read local object (branch, tag).
* You have to fetch remote object first (eg. `git fetch --all`).
* Best use on shared web hosting and enviorment with exploitable
<h1>Put this file anywhere.</h1>
<pre>Print server Variable:
<?php print_r($_SERVER); ?></pre>
<pre>Print base dir of this file:
<?php
$protocol = 'http://';
$host = $_SERVER['HTTP_HOST'];
$file = $_SERVER['SCRIPT_NAME'];
// $baseDir = $protocol.$host.str_replace(basename($file), "", $file);
@indrakaw
indrakaw / .bashrc
Created April 27, 2016 16:50
Default .bashrc fo Ubuntu 16.04 LTS
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@indrakaw
indrakaw / Form-Validation-PHP.md
Last active April 13, 2016 14:47
PHP Form Validation

A very simple PHP Validation.

@indrakaw
indrakaw / csv_to_array.php
Created February 16, 2016 11:53 — forked from jaywilliams/csv_to_array.php
Convert a comma separated file into an associated array.
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@indrakaw
indrakaw / latihan_function_procedure.php
Last active December 15, 2015 23:22
Self-explanation.
<?php
# Dibuat pada 15 November 2015.
# Untuk pempelajaran WebProgramming IKSR 2015-2016.
# Coded by @IndraKaw.
// Fungsi pangkat x^n
function pangkat($nilai, $pangkat) {
$hasil = 1;
for ($i=1; $i <= $pangkat; $i++) {
$hasil=$hasil*$nilai;
@indrakaw
indrakaw / array_to_key.php
Last active October 20, 2015 00:11
Convert $_GET array variable to main key.
<?php
// $_GET to main key.
if (!empty($_GET['name'])) header('Location: '. '.?' .$_GET['name']); // rediriction $_GET's array.
if (!empty($_GET)) die("Hello, ". key($_GET) ."!"); // print end exit the process.
?>
<form method="get"><input type="text" name="name" placeholder="Enter your name..." required></form>