Skip to content

Instantly share code, notes, and snippets.

View akbargumbira's full-sized avatar

Akbar Gumbira akbargumbira

View GitHub Profile
def download_url(manager, url, output_path, progress_dialog=None):
"""Download file from url.
:param manager: A QNetworkAccessManager instance
:type manager: QNetworkAccessManager
:param url: URL of file
:type url: str
:param output_path: Output path
@akbargumbira
akbargumbira / gist:9542300
Last active August 29, 2015 13:57
Improved fix temp
class Downloader(object):
"""The blueprint for downloading file from url."""
def __init__(self, manager, url, output_path, progress_dialog=None):
self.manager = manager
self.url = url
self.output_path = output_path
self.progress_dialog = progress_dialog
self.reply = None
self.output_file = None
self.downloaded_file_buffer = QByteArray()
@akbargumbira
akbargumbira / gist:10020474
Created April 7, 2014 13:39
win 32 qgis 2.2
@echo off
echo.
REM Make parent of this script location our current directory,
REM converting UNC path to drive letter if needed
pushd %~dp0
cd ..
REM set OSGEO4W_ROOT to short path version
for %%i in ("%CD%") do set OSGEO4W_ROOT=%%~fsi
@akbargumbira
akbargumbira / gist:11249841
Last active January 10, 2016 19:34
cmake QGIS
-- QGIS version: 2.3.0 Master (20300)
-- Found GRASS: /usr/lib/grass64 (6.4.3)
-- Found Proj: /usr/lib/libproj.so
-- Found GEOS: /usr/lib/libgeos_c.so
-- Found GDAL: /usr/lib/libgdal.so (1.10.1)
-- Found Expat: /usr/lib/x86_64-linux-gnu/libexpat.so
-- Found Spatialindex: /usr/lib/x86_64-linux-gnu/libspatialindex.so
-- Found Qwt: /usr/lib/libqwt.so (6.0.0-svn)
-- Found Sqlite3: /usr/lib/x86_64-linux-gnu/libsqlite3.so
-- Found PostgreSQL: /usr/lib/libpq.so
category: hazard
subcategory: volcano
title: ATL_tervalidasi
field: KRB
value_map: {'low'. ['Kawasan Rawan Bencana III']}
unit: volcano_categorical
@akbargumbira
akbargumbira / gist:3b97a5430700cc171935
Last active August 29, 2015 14:02
Wizard Dialog Test Windows
def test_keywords_creation_wizard(self):
"""Test how the widgets work."""
expected_category_count = 3
expected_categories = ['exposure', 'hazard', 'aggregation']
chosen_category = 'hazard'
expected_subcategory_count = 4
expected_subcategories = ['volcano', 'earthquake', 'flood', 'tsunami']
chosen_subcategory = "tsunami"
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
FROM ubuntu:14.04
MAINTAINER Akbar Gumbira<[email protected]>
RUN export DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND noninteractive
RUN dpkg-divert --local --rename --add /sbin/initctl
# Use local cached debs from host (saves your bandwidth!)
# Change ip below to that of your apt-cacher-ng host

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@akbargumbira
akbargumbira / gist:0d82f1239987dfd16c6a
Last active August 29, 2015 14:07
ITB Earthquake Pop 5K Fatality
Grid size = (101 100).
Corner coordinates = (114.317624 -6.970125)-(116.842376 -9.469875).
Grid cell size = (0.024752 0.024750).
Source point count = 10100.
Algorithm name: "nearest".
--- Time 20130213112454: 7.83622097969 sec
Grid size = (121 121).
Corner coordinates = (101.417603 -0.939116)-(104.442397 -3.960884).
Grid cell size = (0.024793 0.024769).