Skip to content

Instantly share code, notes, and snippets.

View rbanick's full-sized avatar

Robert Banick rbanick

  • Arbol
  • Ciudad de México, México
View GitHub Profile
@rbanick
rbanick / Replace accented characters.vba
Created April 20, 2015 20:55
Macro to replace accented characters in Excel
Private Function CheckStringCHAR(InString) As String
' CheckStringCHAR(InString)
' Returns its passed agrument, but with exchanged European? characters
' Function created 7/08/2003 by Stanley D. Grom, Jr.
'
CheckStringCHAR = ""
StringLength = Len(InString)
For i = 1 To StringLength
@rbanick
rbanick / thumbnails.sh
Last active July 15, 2018 13:28
Create thumbnails for a bunch of PDFs
#!/bin/bash
# This will convert PDF atlases to .pngs and then convert them back to .PDF, now rasterized.
# Use this script to flatten PDF exports from QGIS so you can generate thumbnails for the Mapfolio
### DEPENDENCIES
# This script uses parallel, imagemagick and ghostscript.
# To install: brew install imagemagick && brew install parallel && brew install gs
# Please note: Ghostscript does not automatically come installed with imagemagick.
@rbanick
rbanick / flatten_atlas.sh
Last active August 29, 2015 14:21
Quickly flattening an atlas of vector PDFs
#!/bin/bash
# This will convert PDF atlases to .pngs and then convert them back to .PDF, now rasterized.
# Use this script to flatten PDF exports from QGIS so you can generate thumbnails for the Mapfolio
# This script uses imagemagick and ghostscript.
# Please note: Ghostscript does not automatically come installed with imagemagick. Run 'brew install gs' to install it.
## Atlas Conversion
@rbanick
rbanick / Convert_pbf_to_obf.md
Last active May 17, 2019 18:48
Creating custom OBF files for OsmAnd
@rbanick
rbanick / building_a_swipe.markdown
Created June 4, 2015 20:45
Building an OSM Before-After Swiper

Building swipers from the Guinea-swipe code

Making the maps

To be filled in!

Cleaning up the code

Github

@rbanick
rbanick / manually_rollback_homebrew.md
Last active August 25, 2020 23:21
How to manually roll back homebrew formula on a UNIX platform

Rolling back Homebrew formula on a UNIX platform

The problem

Sometimes brew updates break your computer or a piece of software. This is usually really unpleasant as it can take some time to diagnose which formula at which version did so. Even if you can diagnose, it's not very clear how to roll back homebrew softwares to previous versions.

How to fix it

@rbanick
rbanick / intersects.sql
Last active August 29, 2015 14:23
Creating intersects in PostGIS -- chitawan example
#### getting intersects of roads from a district. To eliminate bordering things using ST_Contains
DROP TABLE chitawan_roads_intersect;
CREATE TABLE chitawan_roads_intersect
WITH (OIDS)
AS
SELECT osm_roads_4326.*
FROM osm_roads_4326, districts
WHERE
@rbanick
rbanick / generic_sql_gis_aggregation.sql
Last active August 29, 2015 14:24
Generic SQL aggregation
## create summary table
CREATE TABLE temp_table AS
(select
count(id) AS features_per_ADMIN,
avg(master_table.thing_to_average) AS avg_thing_to_average,
sum(master_table.thing_to_sum) AS sum_thing_to_sum,
count(master_table.thing_to_count) AS count_thing_to_count,
COUNT(DISTINCT master_table.thing_to_count_distinct) AS cntd_thing_to_count_distinct,
## ...add as many summary fields as you want here
@rbanick
rbanick / 0_reuse_code.js
Last active August 29, 2015 14:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rbanick
rbanick / qgis_atlas_techniques.markdown
Last active August 18, 2025 20:19
QGIS Atlas Techniques

QGIS Atlas Techniques

Basics

Creating an Atlas Layer

  1. Create a shapefile that includes ONLY the features you want to create an atlas of (e.g. only the districts you want maps of)
  2. Open a new print composer. Give it a name you can remember, like 'Atlas'
  3. Go to the 'Atlas Generation' tab and check the box next to "Generate Atlas".