Skip to content

Instantly share code, notes, and snippets.

View saxenanurag's full-sized avatar
🐍
import this

Anurag Saxena saxenanurag

🐍
import this
View GitHub Profile
@erans
erans / get_lat_lon_exif_pil.py
Created May 20, 2011 21:16
Get Latitude and Longitude from EXIF using PIL
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
// Created by STRd6
// MIT License
// jquery.paste_image_reader.js
(function($) {
var defaults;
$.event.fix = (function(originalFix) {
return function(event) {
event = originalFix.apply(this, arguments);
if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) {
event.clipboardData = event.originalEvent.clipboardData;
@urschrei
urschrei / extract_exif_gps.py
Last active October 26, 2023 20:11
Extract GPS data from jpg files, and write it to a CSV. Requires the PIL. Tested (haha) on Python 2.7.x
"""
Extract GPS coordinates and filename, output to CSV file
Run this file from the same directory the images are in
run using ./process_exif.py or python process_exif.py, or
%run process_exif.py from an IPython instance
Ensure you have PIL installed
refer to http://www.exiv2.org/tags.html for a full detailed tag listing
This is what the GPSInfo dict looks like for an iPhone 5 jpg:

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@duythinht
duythinht / upload_api.py
Created August 26, 2014 15:54
Upload file via flask with appengine
from flask import Blueprint
from flask import render_template as render
from flask import request, Response
import cloudstorage as gcs
from google.appengine.api import app_identity
from os import environ
from json import dumps
module = Blueprint('API_UPLOAD', __name__)

Git Cheat Sheet

Commands

Getting Started

git init

or

@renchap
renchap / README.md
Last active October 12, 2022 17:14
One-line certificate generation/renews with Letsencrypt and nginx

Prerequisites : the letsencrypt CLI tool

This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.

You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge. Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.

I redirect all HTTP requests on HTTPS, so my nginx config looks like :

server {
@jbgo
jbgo / Makefile
Created September 2, 2016 16:41
My vagrant setup for python flask apps
SHELL = /bin/bash
WORKDIR = /vagrant
PSQL = sudo -u postgres psql
DBNAME = changeme
DBUSER = changeme_user
DBPASS = secret
db/console:
$(PSQL) $(DBNAME)

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@enricofoltran
enricofoltran / main.go
Last active July 25, 2024 03:38
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"