Skip to content

Instantly share code, notes, and snippets.

View iyank4's full-sized avatar
🐵
Ngaliwet

Iyan Kushardiansah iyank4

🐵
Ngaliwet
View GitHub Profile
@iyank4
iyank4 / httpd-vhosts.conf
Created March 12, 2014 06:54
XAMPP multi php setup, place PHP folder to php52, php53, php54 and php55
# here: Listen 80
<VirtualHost localhost:80>
ServerName localhost
DocumentRoot "C:/webserver"
</VirtualHost>
<VirtualHost php52.local:80>
ServerName php52.local
DocumentRoot "C:/webserver"
@iyank4
iyank4 / double-subquery
Created July 17, 2014 06:23
Simple SQL Select with Group and Order By Specific Column
SELECT * FROM
(
SELECT * the_table
ORDER BY created_at_field DESC
) t
GROUP BY t.id_field
-- On MySQL with InnoDB engine this query was returning the expected result, but i have no idea with another database and engine.
-- Hopefully this trick would work, tell me if it's not. And maybe you can use more complex query as explined on stackoverflow or others.
@iyank4
iyank4 / gist:02c11742244733e25f12
Created August 22, 2014 11:36
batch rename bash
renaming thumb1_ to thumb_ with single line, tested on cygwin
$ for i in thumb1_*; do mv ${i} ${i/#thumb1_/thumb_}; done
@iyank4
iyank4 / debian-virtual-host-replace-php-handler
Last active December 16, 2015 15:39
Replace default php handler, with another PHP-CGI version
<VirtualHost *:80>
ServerName php52
DocumentRoot /home/iyank4/www
ScriptAlias /cgi-bin/ /home/iyank4/www/cgi-bin/
<FilesMatch ".+\.ph(p[345]?|t|tml)$">
SetHandler None
</FilesMatch>
@iyank4
iyank4 / mysqldump-with-time.sh
Created April 25, 2013 03:49
Script for dump and compress some mysql database
#!/bin/sh
WAKTU=$(date +%Y%m%d_%H%I%S_%Z)
if [ -f alldump.sql ];
then
rm alldump.sql
fi
if [ -f alldump.sql.tar.gz ];
@iyank4
iyank4 / gist:5726882
Created June 7, 2013 03:26
Script to start MySQL workbench if WB cannot communicate with gnome-keyring-daemon
#!/bin/bash
export WB_NO_GNOME_KEYRING=1
mysql-workbench
@iyank4
iyank4 / Regex merapikan script PHP
Last active December 21, 2015 05:08
Search Replace Regex untuk merapikan kode PHP yang berantakan di Sublime Text
Lakukan beberapa kali, hingga semuanya di replace.
Search | Replace
----------------------------------
([a-z_]+);(\n[ ]*)echo => $1. | di search paling belakang kasih 1 spasi setelah echo
>(\n[ ]*)"; => >";
@iyank4
iyank4 / js_autoresize_iframe.html
Created September 15, 2013 18:45
Javascript Autoresize iframe.
<iframe id="myID" src="THE_URL" width="100%" height="20" frameborder="0"></iframe>
<script>
function setIframe() {
$("#dsct").animate({height: $("#dsct").contents().height()+"px"}, 500)
}
$("#myID").load(function() {
setIframe(); // got false height, so we need to execute again after 1 second
setTimeout(function(){ setIframe() },1000);
@iyank4
iyank4 / mysql-user-privileges
Last active January 3, 2016 02:29
Automate grant or revoking privileges of one MySQL user to multiple databases.
#!/bin/bash
#
# Script to automate adding and removing privileges from several databases to specific MySQL user
# Author: Iyan Kushardiansah <iyank4@gmail.com>
# Date: 2014-01-13
#
# MySQL user used for backup
MYSQL_USER="backup4"
On Mac
Enable the minikube registry
$ minikube addons enable registry
find the registry IP
$ kubectl get services -n kube-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 18h
kubernetes-dashboard ClusterIP 10.104.90.254 <none> 80/TCP 18h