Skip to content

Instantly share code, notes, and snippets.

View ebta's full-sized avatar

Ebta Setiawan ebta

View GitHub Profile
@ebta
ebta / ctags.opt
Created February 2, 2013 00:16
Extended ctags regex for javascript, css language. Used mainly in my TagsView plugins for Notepad++ ( can be used for another ctags editor based). Still early development
--langdef=js
--langmap=js:.js
--regex-js=/([A-Za-z0-9._$()]+)[ \t]*[=][ \t]*function[ \t]*\(/\1/,function/
--regex-js=/function[ \t]+([A-Za-z0-9._$]+)[ \t]*\(([^)])\)/\1/,function/
--regex-js=/(var)*[ \t]+(\w+)[ \t]+=/\2/,var/
--langdef=css
--langmap=css:.css
--regex-css=/^[ \t]*\.([A-Za-z0-9_-]+)/.\1/c,class,classes/
--regex-css=/^[ \t]*#([A-Za-z0-9_-]+)/#\1/i,id,ids/
--regex-css=/^[ \t]*(([A-Za-z0-9_-]+[ \t\n,]+)+)\{/\1/t,tag,tags/
@ebta
ebta / crosstab-query-oracle-month.sql
Created February 2, 2013 03:15
Easy way to create crosstab query (monthly based aggregate) in Oracle, without using function or procedure (which is faster)
SELECT
field_1,
id_master,
sum(decode(bln,'01',jumlah)) jan,
sum(decode(bln,'02',jumlah)) feb,
sum(decode(bln,'03',jumlah)) mar,
sum(decode(bln,'04',jumlah)) apr,
sum(decode(bln,'05',jumlah)) mei,
sum(decode(bln,'06',jumlah)) jun,
sum(decode(bln,'07',jumlah)) jul,
<?php
header('HTTP/1.1 403 Forbidden');
?>
<html>
<head>
<title>Congratulations! You have been DENIED access</title>
</head>
<body>
<font size="4">You have been denied access because of the following reasons:<br /><br />
1.) Too many failed login attempts, so you are likely brute forcing through logins.<br />
@ebta
ebta / obj_length.js
Last active August 29, 2015 14:25
Length of a JavaScript object (associative array)
Object.size = function(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
};
// Get the size of an object
var size = Object.size(myArray);
@ebta
ebta / chmod_recursively.sh
Last active August 29, 2015 14:25
chmod all directories or files recursively
# To recursively give directories read&execute privileges:
find /path/to/base/dir -type d -exec chmod 755 {} +
# To recursively give files read privileges:
find /path/to/base/dir -type f -exec chmod 644 {} +
# Or, if there are many objects to process:
chmod 755 $(find /path/to/base/dir -type d)
chmod 644 $(find /path/to/base/dir -type f)
@ebta
ebta / fossil-checkout.php
Created July 27, 2015 04:44
Fossil checkout (server side) through PHP
<?php
/* fossil-checkout.php
* Untuk melakukan checkout fossil di server tanpa harus login SSH
*
* Agar bisa berjalan, Fossil butuh HOME variabel : putenv()
* Add server environment. The environment variable will only exist
* for the duration of the current request. At the end of the request
* the environment is restored to its original state
* */
Number.prototype.formatMoney = function(c, d, t){
var n = this,
c = isNaN(c = Math.abs(c)) ? 2 : c,
d = d == undefined ? "." : d,
t = t == undefined ? "," : t,
s = n < 0 ? "-" : "",
i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "",
j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};
@ebta
ebta / fossil.sh
Created August 3, 2015 04:52
Menjalankan Fossil di Server Ubuntu Linux Server
# Menjalankan fossil di server sebagai service
# Jangan sebagai root, karena ada masalah hak akses, jadi perlu user lain
# /repo/path adalah lokasi repository *.fossil
su user -c "nohup fossil server --port 1234 /repo/path > /dev/null 2>&1 &"
@ebta
ebta / dat2mp4.bat
Created April 24, 2016 14:58
Fast convert VCD (*.dat) to MP4 with ffmpeg
"C:\Dir\ffmpeg\bin\ffmpeg" -i %1 -vcodec copy -acodec copy "F:\TargetDir\%~n1.mp4"
@ebta
ebta / update.sh
Last active April 26, 2016 16:01
Update Apache 2.4.7 to latest version (Ubuntu 14.04)
cd
wget http://www-eu.apache.org/dist//httpd/httpd-2.4.20.tar.gz
tar xf httpd-2.4.12.tar.gz
cd httpd-2.4.12
./configure
make
make install
; if needed, download apr and apr-util from here https://apr.apache.org/download.cgi
; extract and move folder to httpd-2.4.x/srclib, rename with just 'apr' and 'apr-util'