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
@baijum
baijum / example.go
Created May 2, 2018 07:27 — forked from mjs/example.go
Example of github.com/pkg/errors
package main
import (
"fmt"
"github.com/pkg/errors"
)
func A() error {
// New errors created with pkg/errors.New() will include a full
@baijum
baijum / HOWTO.md
Created February 22, 2018 17:50 — forked from cvan/HOWTO.md
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@baijum
baijum / ngrxintro.md
Created February 22, 2018 12:07 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@baijum
baijum / connections.txt
Created January 15, 2018 05:50 — forked from tristanwietsma/connections.txt
Three digit LED control for Arduino Arduino sketch to control a 3 digit LED display (TOT-5361BE-D).
Connect the Arduino UNO pins "(x)" to the LED leads "-" as follows:
_________
| |
(1)-| ***** |-(11)
| * * * |
(2)-| ***** |-(10)
| |
(3)-| ***** |-(9)
| * * * |
@baijum
baijum / postgres_array.go
Created October 20, 2017 09:35 — forked from adharris/postgres_array.go
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@baijum
baijum / design.go
Created September 28, 2017 08:50 — forked from aslakknutsen/design.go
JSON API ResourceObject GOA
// Definition
/*
func test() {
account := app.AccountSingle{}
account.Data.ID
account.Data.Type
account.Data.Attributes.Name
account.Data.Relationships.OwnedBy
account.Data.Relationships.OwnedBy.Meta
account.Data.Relationships.OwnedBy.Related
@baijum
baijum / tmux.cheat
Created February 14, 2017 15:05 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@baijum
baijum / API.md
Last active September 20, 2015 16:25 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@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)
@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' '*';
#