Skip to content

Instantly share code, notes, and snippets.

View neofreko's full-sized avatar

Akhmad Fathonih neofreko

View GitHub Profile
neofreko / delete-fb-test-users.php
Last active August 29, 2015 14:07
Delete fb test users recursively
View delete-fb-test-users.php
// jSON URL which should be requested
$app_id = 'app id';
// get access token here:
//<app id>&client_secret=<app secret>&grant_type=client_credentials
$app_access_token = 'access token';
$json_url = ''.$app_id.'/accounts/test-users?access_token='.$app_access_token;
neofreko / 00-rebuild-nginx.config
Created February 19, 2015 09:38
Configuring TCP service on Elastic Beanstalk ref:
View 00-rebuild-nginx.config
git: []
gcc: []
gcc-c++: []
make: []
zlib-devel: []
pcre-devel: []
openssl-devel: []
libxml2-devel: []
View tldr.js
var summary = require('node-tldr');
summary.summarize('', function(result, failure) {
if (failure) {
console.log("An error occured! " + result.error);
neofreko / feed-tldr.js
Created October 9, 2015 01:06
parse feed and run tldr on the feed item urls
View feed-tldr.js
var FeedParser = require('feedparser'),
request = require('request'),
summary = require('node-tldr'),
Promise = require('promise');
function summarize(link) {
return new Promise(function(resolve, reject) {
summary.summarize(link, function(result, failure) {
if (failure) {
console.log("An error occured! " + result.error);
neofreko /
Created October 10, 2012 14:46
Version bumper for Android manifest
#configure this as external tool to run on your project
#git revision
rev=$(git log --pretty=format:'%h' -n 1)
#version code
vc=$(grep android:versionCode AndroidManifest.xml | cut -f2 -d\")
neofreko / IndexController.php
Last active December 10, 2015 01:58 — forked from anonymous/IndexController.php
I wish I have mail-preview.rb in PHP. Originally, these are part of ZF (CLI) controller code. Converting to non-controller is left as exercise for the reader. Yes, I stole the template from the original erb
View IndexController.php
class IndexController {
public function mailpreviewAction() {
$getopt = $this->getRequest()->getOpt();
$extra = $getopt->getRemainingArgs();
// create new getopt
$cliopt = new Zend_Console_Getopt(array(
'filename|f=s' => 'Zend generated email',
'browser|b=s' => 'Open using specified browser app'
neofreko / base.pegjs
Created February 24, 2013 07:47
A common validator
View base.pegjs
= expr
= & blank* left:(primitive / compound)+ blank* {return left}
= left:compound+ {return left}
= left:primitive blank right:primitive {return [left, right]}
neofreko / weather.pegjs
Created February 24, 2013 08:02
weather grammar for my poor man's nlp
View weather.pegjs
= left:weather blank right:location {return [left, right]}
= & blank* left:(primitive / compound)+ blank*
= left:compound+ {return left}
= left:primitive blank right:primitive {return left+right}
View yql-404.xml
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="">
<author>Akhmad Fathonih</author>
<description>URL 404 check</description>
USE '' AS mytable;select * from mytable where url = '']]></sampleQuery>
neofreko / anno.txt
Created December 28, 2013 19:20
Given a node annotated with this JSON, how would you visualize those nodes. How do you browse thru it?
View anno.txt
[ { start: 13,
end: 19,
spot: 'DESIGN',
confidence: 0.158,
id: 8560,
title: 'Design',
uri: '',
abstract: 'Design is the creation of a plan or convention for the construction of an object or a system (as in architectural blueprints, engineering drawings, business processes, circuit diagrams and sewing patterns). Design has different connotations in different fields (see below). In some cases the direct construction of an object (as in pottery, engineering, management, cowboy coding and graphic design) is also considered to be design.',
label: 'Design',
categories: [ 'Design', 'Architectural design', 'Arts' ] },