Skip to content

Instantly share code, notes, and snippets.

View heruputra's full-sized avatar
🌴
On vacation

Heru Hang Tryputra heruputra

🌴
On vacation
  • Yogyakarta, Indonesia
View GitHub Profile
@heruputra
heruputra / imgcmp.py
Created October 8, 2016 19:23 — forked from attilaolah/imgcmp.py
Fast image comparison with Python
import math
import Image
import Levenshtein
class BWImageCompare(object):
"""Compares two images (b/w)."""
_pixel = 255
@heruputra
heruputra / default.conf
Created August 3, 2016 09:10 — forked from cbmd/default.conf
nginx config - dynamic virtual hosts
server {
index index.php;
set $basepath "/var/www";
set $domain $host;
# check one name domain for simple application
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
@heruputra
heruputra / upgrade-everything.sh
Created February 21, 2016 14:45 — forked from mul14/upgrade-everything.sh
Upgrade Everything
#!/usr/bin/env sh
sh $HOME/.oh-my-zsh/tools/upgrade.sh
pip3 install --upgrade pip
pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
pip2 install --upgrade pip
pip2 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip2 install -U
module.exports = {
/**
*
* Using raw socket.io functionality from a Sails.js controller
*
*/
index: function (req,res) {
// api/controllers/AuthController.js
var passport = require('passport');
var AuthController = {
login: function (req,res)
{
res.view();
},
var fs = require('fs')
, path = require('path')
, _ = require('underscore');
var rootPath = "/path/to/remove";
removeDirForce(rootPath);
// path should have trailing slash
function removeDirForce(dirPath) {
fs.readdir(dirPath, function(err, files) {
@heruputra
heruputra / gist:7672924
Last active December 29, 2015 12:49
untuk udin
<?php
// ini di controller
// nama file BlogController.php
class BlogController extends BaseController {
public function index() {
$posts = Post::all();
<?php
/**
* Simple excel writer class with no external dependencies, drop it in and have fun
* @author Matt Nowack
* @license Unlicensed
* @version 1.0
*/
class Excel {
private $col;
{
"name": "cakephp-application",
"repositories": [
{
"type": "pear",
"url": "http://pear.cakephp.org"
}
],
"require": {
"pear-cakephp/cakephp": ">=2.4.0"
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) { echo "ERROR: $error_number : $err_string";
return false;