Skip to content

Instantly share code, notes, and snippets.

View joglomedia's full-sized avatar
🏠
Working from home

Edi Septriyanto joglomedia

🏠
Working from home
View GitHub Profile
@joglomedia
joglomedia / blogger_recent_comment.js
Created June 10, 2013 14:40
Blogger Recent Comment Widget
function showrecentcomments(json){
for(var i=0;i<a_rc;i++){
var b_rc=json.feed.entry[i];var c_rc;if(i==json.feed.entry.length)break;for(var k=0;k<b_rc.link.length;k++){if(b_rc.link[k].rel=='alternate'){c_rc=b_rc.link[k].href;break;}}c_rc=c_rc.replace("#","#");var d_rc=c_rc.split("#");d_rc=d_rc[0];var e_rc=d_rc.split("/");e_rc=e_rc[5];e_rc=e_rc.split(".html");e_rc=e_rc[0];var f_rc=e_rc.replace(/-/g," ");f_rc=f_rc.link(d_rc);var g_rc=b_rc.published.$t;var h_rc=g_rc.substring(0,4);var i_rc=g_rc.substring(5,7);var j_rc=g_rc.substring(8,10);var k_rc=new Array();k_rc[1]="Jan";k_rc[2]="Feb";k_rc[3]="Mar";k_rc[4]="Apr";k_rc[5]="May";k_rc[6]="Jun";k_rc[7]="Jul";k_rc[8]="Aug";k_rc[9]="Sep";k_rc[10]="Oct";k_rc[11]="Nov";k_rc[12]="Dec";if("content" in b_rc){var l_rc=b_rc.content.$t;}else if("summary" in b_rc){var l_rc=b_rc.summary.$t;}else var l_rc="";var re=/<\S[^>]*>/g;l_rc=l_rc.replace(re,"");document.write('<div class="rcw-comments">');if(m_rc==true)document.write('On '+k_rc[parseInt(i_rc,10)]+' '+j_rc+' ');document.
@joglomedia
joglomedia / Useful Gitlab Command and Troubleshot
Created October 16, 2013 19:21
Useful Gitlab Command and Troubleshot
# Check requirement
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
# Check everything is working
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production
# Troubleshot: Commit / Merge Request Error #
@joglomedia
joglomedia / wordpress-limit-access-to-post-by-user-roles
Created November 28, 2013 07:21
WordPress limit access to posts/pages by user roles
you can use such conditions to show private posts only to logged in users with role contributor. Now you only need to make post private to make that post available for contributor.
Ref: http://wordpress.stackexchange.com/questions/60582/limit-access-to-posts-pages-by-user-roles
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
$private = get_post_custom_values("private");
if (isset($private[0]) && $private == "true") {
if ( current_user_can( 'contributor' ) ) { //passing role to it may sometime not work
the_title();
@joglomedia
joglomedia / Megasync-script
Created November 28, 2013 07:50
MegaSync script
Ref: http://albertolarripa.com/2013/07/10/megatools-synchronizing-your-backups-to-mega/
#!/bin/sh
MEGASYNC='/usr/local/bin/megasync'
MEGARM='/usr/local/bin/megarm'
LOCALDIR="/usr/local/data/backups"
REMOTEDIR="/Root/albertolarripa/backups"
SEDLOCALDIR="\/usr\/local\/data\/backups"
SEDREMOTEDIR="\/Root\/albertolarripa\/backups"
@joglomedia
joglomedia / Skrill.php
Last active December 30, 2015 07:59
Skrill webform/offsite payment gateway for BoxBilling
<?php
/**
* BoxBilling
*
* LICENSE
*
* This source file is subject to the license that is bundled
* with this package in the file LICENSE.txt
* It is also available through the world-wide-web at this URL:
* http://www.boxbilling.com/LICENSE.txt
@joglomedia
joglomedia / python-276-installer-centos.sh
Last active July 1, 2021 03:05
Install Python 2.7.3 on CentOS 5.x (tested on CentOS 5.10) # (c) 2013 - MasEdi (http://masedi.net/)
#!/bin/bash
# (c) 2013 - MasEdi (http://masedi.net/)
yum groupinstall "Development tools"
yum install zlib-devel
yum install bzip2-devel openssl-devel ncurses-devel automake make
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
tar zxf Python-2.7.3.tar.bz2
cd Python-2.7.3
./configure --prefix=/usr/local
/*
* Display Image from the_post_thumbnail or the first image of a post else display a default Image
* Chose the size from "thumbnail", "medium", "large", "full" or your own defined size using filters.
* USAGE: <?php echo my_image_display(); ?>
*/
function my_image_display($size = 'full') {
if (has_post_thumbnail()) {
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, $size);
@joglomedia
joglomedia / phalcon-generate-hashed-filename-for-compiled-path
Last active August 29, 2015 14:13
Phalcon: Generate Hashed Filename for Compiled Template Path
closure to generate hashed filename for Phalcon template compiled path kind of file:
```php
<?php
$volt->setOptions(array(
'compiledPath' => function($templatePath) {
return md5($templatePath) . '.php';
}
));
@joglomedia
joglomedia / ffmpeg_installer
Last active July 30, 2021 00:59
Simple Bash Script to Install FFMPEG + Required Libraries in Ubuntu 14.04
#!/bin/bash
# Bash Script to Install FFMPEG in Ubuntu 14.04
# Ref: http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
# Opsional: install exiftool: apt-get install libimage-exiftool-perl
#
# Author: Edi Septriyanto http://masedi.net <[email protected]>
########################################################################
CURDIR=$(pwd)
@joglomedia
joglomedia / yt-upload.py
Created March 1, 2015 13:01
Youtube Upload
#!/usr/bin/python2
#
# Youtube-upload is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Youtube-upload is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the