Skip to content

Instantly share code, notes, and snippets.

View gnsx's full-sized avatar

Kevin D'Souza gnsx

View GitHub Profile
import os
import boto3
from botocore.exceptions import ClientError
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
# Setup the basics here
SENDER = "yourname@domain.com"
RECIPIENT = "rec@domain.com"
SUBJECT = "Customer service contact info"
mkdir nominatimdata
cd nominatimdata
wget https://download.geofabrik.de/asia/sri-lanka-latest.osm.pbf
wget https://download.geofabrik.de/asia/india-latest.osm.pbf
wget https://download.geofabrik.de/asia/bangladesh-latest.osm.pbf
wget https://download.geofabrik.de/asia/nepal-latest.osm.pbf
osmconvert bangladesh-latest.osm.pbf --out-o5m | osmconvert - nepal-latest.osm.pbf -o=bang-nep.pbf
osmconvert bang-nep.pbf --out-o5m | osmconvert - sri-lanka-latest.osm.pbf -o=bang-nep-sl.pbf
Understand What is Programming
https://www.futurelearn.com/courses/programming-101/0/steps/43783
Further Reading
Data Types: https://en.wikipedia.org/wiki/Data_type
Data Structures: https://www.geeksforgeeks.org/data-structures/
What are programming languages
https://www.geeksforgeeks.org/introduction-to-programming-languages/
package main
import "fmt"
//Point2D Structure
type Point2D struct {
x float64
y float64
}
#for python 2.7
#!/usr/bin/env python
"""
Extract all attachments from '.eml' file EML_FILE into
directory OUTPUT_DIR. If OUTPUT_DIR does not exist, it will be
created.
Usage: extract_attachments.py EML_FILE OUTPUT_DIR
"""
import sys
import os
//Base example to use while multithreading in golang
package main
import (
"fmt"
)
func main() {
done := make(chan bool)
tasks := make(chan int64)
/*Athena Query to get data between dates using epoch for timestamp*/
SELECT distinct(unique_id) AS unique_id ,
second_field
FROM "table_name"
WHERE from_unixtime(epoch_time,'Asia/Kolkata') < (CURRENT_DATE - interval '1' DAY)
AND from_unixtime(epoch_time,'Asia/Kolkata') > (CURRENT_DATE - interval '2' DAY)
AND second_field = 'UPLIFTED'
package main
import (
b64 "encoding/base64"
"fmt"
"io/ioutil"
"os"
)
func main() {
//Sort implementation for custom types
// Encapsulates the statistical data that CloudWatch computes from metric data.
type Datapoint struct {
_ struct{} `type:"structure"`
// The average of the metric values that correspond to the data point.
Average *float64 `type:"double"`
// The percentile statistic for the data point.
ExtendedStatistics map[string]*float64 `type:"map"`
@gnsx
gnsx / go-sort-map.go
Created February 15, 2019 11:23 — forked from flaviocopes/go-sort-map.go
Go: sort a Map by key #golang
import "sort"
ages := map[string]int{
"a": 1,
"c": 3,
"d": 4,
"b": 2,
}
names := make([]string, 0, len(ages))