Skip to content

Instantly share code, notes, and snippets.

View sabman's full-sized avatar
😀
Building, Shiping, Sharing!

Shoaib Burq sabman

😀
Building, Shiping, Sharing!
View GitHub Profile
@sabman
sabman / torchgeo_object_detection_example.ipynb
Created October 30, 2023 11:23 — forked from calebrob6/torchgeo_object_detection_example.ipynb
Short example of object detection training in TorchGeo.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sabman
sabman / H3_lut.sql
Created July 24, 2023 20:16 — forked from francois-baptiste/H3_lut.sql
Building a lookup table for spatial cloaking based on Uber’s Hexagonal Hierarchical Spatial Index, H3 with Bigquery
With T0 AS(
SELECT population, libjs4us.h3.ST_H3(ST_GEOGPOINT(longitude_centroid, latitude_centroid), 10) key FROM `bigquery-public-data.worldpop.population_grid_1km` WHERE last_updated = "2017-01-01"
),
T1 AS (
SELECT sum(population) population, key
from T0
group by key),
T2 AS (SELECT
array (SELECT
struct(libjs4us.h3.h3ToParent(key,len) as key, population) mystruct
@sabman
sabman / Gemfile
Created September 21, 2022 14:24 — forked from bosskovic/Gemfile
Devise as authentication solution for rails API
gem 'devise', '3.2.4'
gem 'simple_token_authentication', '1.5.0'
@sabman
sabman / spatialite_example.go
Created June 13, 2022 18:12 — forked from ptrv/spatialite_example.go
SpatiaLite example in Go
package main
import (
"database/sql"
"github.com/mattn/go-sqlite3"
"log"
"os"
)
func runQuery(db *sql.DB, query string) {
#!/bin/sh
# The least terrible way to resolve a symlink to its real path.
function realpath() {
/usr/bin/perl -e "use Cwd;print Cwd::abs_path(@ARGV[0])" "$0";
}
CONTENTS="$(dirname "$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")")"
# BINARY_NAME="$(ls "$CONTENTS/MacOS/")"
BINARY_NAME="$(command ls --color=none "$CONTENTS/MacOS/")"
@sabman
sabman / info.json
Created November 23, 2021 20:01
TileJSON.io - wardboundaries_21610
{
"baseLayer": {
"tilejson": "2.2.0",
"name": "base",
"version": "1.0.0",
"scheme": "xyz",
"tiles": [
"https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"
]
},
@sabman
sabman / bash_strict_mode.md
Created November 22, 2021 14:23 — forked from maxisam/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
first_name last_name email gender 4ip_address
Lauri Luddy lluddy0@lycos.com Female 11.11.11.11
Arline Schmidt aschmidt1@ovh.net Female 99.164.236.22
Jorgan Siss jsiss2@fotki.com Male 224.205.106.99
Pascale Jagg pjagg3@cpanel.net Male 148.160.64.222
Karmen Kuhnert kkuhnert4@joomla.org Female 236.208.38.56
Romeo Ranscome rranscome5@bloomberg.com Male 38.213.85.249
Duffie Petkens dpetkens6@usda.gov Male 125.137.32.0
Angeline Raulin araulin7@alibaba.com Female 172.168.6.1
Camel Felce cfelce8@unc.edu Female 91.4.140.24
# Blog post for this: https://medium.com/@sabman/running-rails-5-0-1-postgis-using-docker-compose-2-a0ce5e5fbaba#.j6scfvmw6
APP_NAME=dockerized-rails
rails _5.0.1_ new $APP_NAME -d postgresql
cd $APP_NAME
mkdir -p containers/development
RAILS_ENV=development
# 1. create a Dockerfile for development
cat > ./containers/development/Dockerfile <<EOF