Skip to content

Instantly share code, notes, and snippets.

@ns-1m
ns-1m / gist:2296532
Created April 4, 2012 00:04
PHP Spatialite to GeoJSON
<?php
/**
* Spatialite to GeoJSON
It needs:
* apache2
* php5-cli
* php5-sqlite
@ns-1m
ns-1m / gist:2862176
Created June 3, 2012 06:04 — forked from plapier/gist:2044437
CSS/Sass Modal Dialog
<!-- HTML -->
<div class="modal-dialog-background">
<div class="modal-dialog">
<h1>Submit</h1>
<div class="inner-wrapper">
<p>Press submit to record your answers.</p>
</div>
<div class="buttons">
<button type="button" class="cancel">Cancel</button>
<button type="button" class="submit">Submit</button>
@ns-1m
ns-1m / cbc_mac_os_x_logs
Created November 19, 2012 05:00
CBC make install in Mac OS X
Last login: Mon Nov 19 14:51:53 on ttys003
Nolis-MacBook-Pro:Cbc-2.7.7_2 nsicad$ make install
Making install in ThirdParty/Glpk
test -z "/Users/nsicad/Documents/Cbc-2.7.7_2/lib" || /Users/nsicad/Documents/Cbc-2.7.7_2/ThirdParty/Glpk/install-sh -d "/Users/nsicad/Documents/Cbc-2.7.7_2/lib"
/bin/sh ./../../libtool --mode=install /usr/bin/install -c 'libcoinglpk.la' '/Users/nsicad/Documents/Cbc-2.7.7_2/lib/libcoinglpk.la'
/usr/bin/install -c .libs/libcoinglpk.1.8.2.dylib /Users/nsicad/Documents/Cbc-2.7.7_2/lib/libcoinglpk.1.8.2.dylib
(cd /Users/nsicad/Documents/Cbc-2.7.7_2/lib && { ln -s -f libcoinglpk.1.8.2.dylib libcoinglpk.1.dylib || { rm -f libcoinglpk.1.dylib && ln -s libcoinglpk.1.8.2.dylib libcoinglpk.1.dylib; }; })
(cd /Users/nsicad/Documents/Cbc-2.7.7_2/lib && { ln -s -f libcoinglpk.1.8.2.dylib libcoinglpk.dylib || { rm -f libcoinglpk.dylib && ln -s libcoinglpk.1.8.2.dylib libcoinglpk.dylib; }; })
/usr/bin/install -c .libs/libcoinglpk.lai /Users/nsicad/Documents/Cbc-2.7.7_2/lib/libcoinglpk.la
---------
@ns-1m
ns-1m / TimberHarvestModel_0025p_cplex.lp
Created November 19, 2012 04:04
TimberHarvestModel_0025p CPLEX file
\* Problem: TimberHarvestModel_0025p *\
Maximize
Discounted_Net_Value: + 28320 FStand(4,1) + 19680 FStand(4,2)
+ 13626.6666666667 FStand(4,3) + 9173.33333333333 FStand(4,4)
+ 6162.96296296296 FStand(4,5) + 4140.24691358025 FStand(4,6)
+ 18960 FStand(5,1) + 13740 FStand(5,2) + 9946.66666666667 FStand(5,3)
+ 7102.22222222222 FStand(5,4) + 5031.11111111111 FStand(5,5)
+ 3520 FStand(5,6) + 26430 FStand(15,1) + 18480 FStand(15,2)
+ 12920 FStand(15,3) + 8977.77777777778 FStand(15,4)
@ns-1m
ns-1m / TimberHarvestModel_0025p_freemps.mps
Created November 18, 2012 23:18
TimberHarvestModel_0025p_freemps.mps
* Problem: TimberHarvestModel_0025p
* Class: MIP
* Rows: 464
* Columns: 255 (249 integer, 249 binary)
* Non-zeros: 1421
* Format: Free MPS
*
NAME TimberHarvestModel_0025p
ROWS
N Discounted_Net_Value
@ns-1m
ns-1m / TimberHarvestModel_0025p_mps.mps
Created November 18, 2012 23:11
TimberHarvestModel_0025p_mps.mps
* Problem: TimberHarvestModel_0025p
* Class: MIP
* Rows: 464
* Columns: 255 (249 integer, 249 binary)
* Non-zeros: 1421
* Format: Fixed MPS
*
NAME TimberHa
ROWS
N R0000001
@ns-1m
ns-1m / install-pygtk.sh
Created November 16, 2012 05:56 — forked from ches/install-pygtk.sh
Install PyGTK via Homebrew and virtualenv
# This LOOKS pretty straightforward, but it took awhile to sort out issues with
# py2cairo and pygobject, so I hope I've saved you some time :-)
#
# This assumes you already subscribe to a nice clean virtualenvwrapper workflow
# -- see https://gist.github.com/771394 if you need advice on getting there.
# There are some optional dependencies omitted, so if you're going to be doing
# heavy development with these libs, you may want to look into them.
#
# We go to some configure option pains to avoid polluting the system-level
# Python, and `brew link`ing Cairo which is keg-only by default.
@ns-1m
ns-1m / gist:4049127
Created November 9, 2012 23:58 — forked from NathanW2/gist:4029400
Print composer
from qgis.core import *
from qgis.gui import *
from PyQt4.QtCore import *
from PyQt4.QtGui import QApplication
from PyQt4.QtXml import *
import sys
import xml.etree.ElementTree as ET
app = QgsApplication([], True)
@ns-1m
ns-1m / sqlite2pg.sh
Created October 27, 2012 04:47 — forked from eclubb/sqlite2pg.sh
Script to import SQLite3 database into PostgreSQL
#!/bin/sh
# This script will migrate schema and data from a SQLite3 database to PostgreSQL.
# Schema translation based on http://stackoverflow.com/a/4581921/1303625.
# Some column types are not handled (e.g blobs).
SQLITE_DB_PATH=$1
PG_DB_NAME=$2
PG_USER_NAME=$3
@ns-1m
ns-1m / qgis-nightly-build.sh
Created August 2, 2012 01:37 — forked from dakcarto/qgis-nightly-build.sh
Bash script for local nightly builds of QGIS master branch on Mac OS X Snow Leopard and Lion
#!/bin/bash
# -*- coding: utf-8 -*-
#
# Create QGIS for Mac OS X nightly build from github.com 'master' branch.
# Keep a number of dmg archives of previous builds as backups.
#
# Tested under Lion 10.7.4 and Snow Leopard 10.6.8, **run via sudo**
# Requires same kyngchaos.com framework setup and build environment as per