Skip to content

Instantly share code, notes, and snippets.

View baijum's full-sized avatar
🏠
Working from home

Baiju Muthukadan baijum

🏠
Working from home
  • Red Hat
  • India
View GitHub Profile
package main
// using asymmetric crypto/RSA keys
import (
"fmt"
"io/ioutil"
"log"
"net/http"
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
package main
import (
"fmt"
"net/http"
"sync"
"time"
)
func basics() {
* http://iswwwup.com/t/fe6fb8348903/nginx-how-to-setup-cross-domain-rules-in-discourse.html
* http://discuss.emberjs.com/t/apache-rewrite-rule-for-html5-browser-history-url-bookmarkability/1013
* http://readystate4.com/2012/05/17/nginx-and-apache-rewrite-to-support-html5-pushstate/
* https://gist.github.com/Stanback/7145487
* http://serverfault.com/questions/393532/allowing-cross-origin-requests-cors-on-nginx-for-404-responses
* http://enable-cors.org/server_nginx.html
@baijum
baijum / webtail.py
Last active August 29, 2015 14:23 — forked from maximebf/webtail.py
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver
package main
import "fmt"
func StartsCapital(s string) bool {
for _, v := range "ABCDEFGH" {
if string(s[0]) == string(v) {
return true
}
}
@baijum
baijum / example
Last active August 29, 2015 14:25 — forked from koreno/README.md
'rebaser' improves on 'git rebase -i' by adding information per commit regarding which files it touched.
pick d0d13d0 1:removed some bullshit from __entrypoint.d _________9______
pick a44e878 2:Improvements to object.d and __entrypoint.d ________89______
pick 12c5b47 3:Add usage to build.d ___3____________
pick 318af43 4:Added .gitignore ______________e_
pick eb9ad0f 5:Attempting to add more array support _1_3_56_89abcd__
pick 8b8df05 6:Added some special support for ldc to object.d ________8_______
pick e630300 7:Removed imports from build ___3____________
pick 69ae673 8:c-main to d-main __2345_7_9______
pick c00b344 9:Implemented write an exit system calls _1_345678_______
pick 3901cca 10:Add wscript_build file 0__3____________
@baijum
baijum / nginx.conf
Last active August 29, 2015 14:28 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers
@baijum
baijum / cors-nginx.conf
Last active September 10, 2015 10:11 — forked from michiel/cors-nginx.conf
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@baijum
baijum / get_lat_lon_exif_pil.py
Last active September 16, 2015 19:51 — forked from erans/get_lat_lon_exif_pil.py
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)