Skip to content

Instantly share code, notes, and snippets.

View jerieljan's full-sized avatar

Jeriel Jan del Prado jerieljan

View GitHub Profile
@jerieljan
jerieljan / simple-sync
Last active August 29, 2015 14:17
A simple shell script that consistently observes a directory and synchronizes its contents when changes are found, using rsync's one-way sync.
#!/bin/sh
## A simple shell script that consistently observes a directory and synchronizes its contents when changes are found, using rsync's one-way sync.
## Most of the heavy lifting is really done by rsync, so what this script provides is just convenience over cron, notifications (if you have notify-pb) and rsync not being spammed by said cron job through a simple lockfile.
## simple-sync requires rsync, notify-pb (Pushbullet) and preferably run by a scheduler such as cron.
# Core variables
SYNC_HOME='/home/user'
SYNC_SOURCE='user@server.com:/path/to/source/*'
SYNC_DESTINATION="${SYNC_HOME}/path/to/destination/"
@jerieljan
jerieljan / manage-dir.sh
Last active August 29, 2015 14:08
Manage directories' files using a simple shell script! This script simply relocates files from a base directory to a subdirectory based on its file format.
#!/bin/bash
# A basic directory management script file.
# Add this to incron via incrontab -e with the IN_CLOSE_WRITE and IN_MOVED_TO flag.
# Usage: manage-dir.sh <file-to-process> <base-directory>
INCOMING="$1"
BASE_DIR="$2"
SUBFOLDER=""
ICON="/usr/share/icons/gnome/32x32/actions/document-save-as.png"
@jerieljan
jerieljan / config.yml
Created August 10, 2014 12:40
This is my personal Flexget configuration file. Simply follow the Flexget Installation Guide and apply this config to your ~/.flexget/ directory.
# Flexget Config
# @author jerieljan
templates:
anime:
inputs:
- rss: { url: 'http://www.nyaa.eu/?page=rss&cats=1_37&filter=2', silent: yes, ascii: yes }
- rss: { url: 'http://tokyotosho.info/rss.php?filter=1', silent: yes, ascii: yes }
series:
settings:
@jerieljan
jerieljan / Job.java
Created August 7, 2014 00:46
Dealing with long-running, processor-intensive tasks happen, and sometimes, requests for the same tasks get triggered and your system ends up attempting to process the -same- thing multiple times. JobManager is an attempt to resolve that by taking note of each Task<Result> as Jobs, which takes care of assigning future reattempts into existing Jo…
/*
* Job
* v1.0
* June 18, 2014
*
* Copyright 2014, Jeriel Jan del Prado
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
@jerieljan
jerieljan / facebook-css.css
Last active August 29, 2015 14:04
Facebook - No Right Column, Collapsed Left Column
#rightCol {
display:none !important;
}
#leftCol {
width:48px !important;
}
#leftCol:hover {
width:165px !important;
@jerieljan
jerieljan / SynchronizedRedisBlock.java
Created July 28, 2014 01:32
The SynchronizedRedisBlock can be used to create a self-isolating block of Redis transactions with a locking mechanism based on the key name provided. Implement by simply instantiating this class and placing all relevant Redis transactions when implementing #perform().
/*
* SynchronizedRedisBlock v1.0
* v1.0
* June 18, 2014
*
* Copyright 2014, Jeriel Jan del Prado
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
@jerieljan
jerieljan / custom_rules.xml
Created July 24, 2013 01:20
A custom_rules XML file in Ant for performing Robotium tests.
<?xml version="1.0" encoding="UTF-8"?>
<!-- custom_rules.xml contains a set of added functions for Ant to use. This includes useful macrodefs for
testing a particular test case or package, and you can even define your own that executes them for convenience. -->
<project name="RobotiumMyProject">
<property name="reports.dir" value="reports"/>
<property name="tests.dir" value="com.jerieljan.myproject.tests"/>
<target name="init-props">
@jerieljan
jerieljan / ShowListView.java
Created July 11, 2013 09:18
A slightly customized list view for displaying shows. Provides handling for touch event greed. This is used so that the main list will not deprive the ViewPager List from horizontal swipe events for changing displayed shows per channel.
package ph.com.voyager.epg.ui;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListView;
/**
* A slightly customized list view for displaying shows. Provides handling for touch event greed.
* This is used so that the main list will not deprive the ViewPager List from horizontal swipe
package ph.com.voyager.epg.core.model.volley;
import com.android.volley.toolbox.ImageLoader;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
/**
* A straightforward implementation of the {@link ImageLoader.ImageCache ImageCache} in LruCache
* provided by Android + Support Library.
// Copyright 2008 - Team Servo
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using MySql.Data.MySqlClient;