Skip to content

Instantly share code, notes, and snippets.

View kirang89's full-sized avatar

Kiran Gangadharan kirang89

View GitHub Profile
@kirang89
kirang89 / logfileparse.awk
Created December 13, 2015 16:49
A simple example to illustrate log file parsing using AWK
#!/usr/bin/awk -f
BEGIN {
requests = 0
getrq = 0
postrq = 0
count = 0
}
$0 ~ /(GET|POST)/ {
@kirang89
kirang89 / validmacro.clj
Last active November 18, 2015 19:30
Custom implementation of an if-valid and when-valid macro based on Chapter 8 of Clojure for the Brave and True
;;
;; Custom implementation based on http://www.braveclojure.com/writing-macros
;;
(ns clojurist.core
(:gen-class))
(def order-details-valid
{:name "Kiran Gangadharan"
:email "kiran.daredevil@gmail.com"})
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
from datetime import datetime
class DictMixin(object):
def to_dict(self):
return self._parse_dict(self.__dict__)
@kirang89
kirang89 / ipsh.py
Created June 14, 2015 17:53
Drop into an embedded IPython session for debugging purposes
"""Drop into an embedded IPython session for debugging purposes.
From <http://stackoverflow.com/questions/16867347/
step-by-step-debugging-with-ipython/23388116#23388116>"""
from IPython.terminal.embed import InteractiveShellEmbed
from IPython.config.loader import Config
import inspect
# Configure the prompt so that I know I am in a nested (embedded) shell
@kirang89
kirang89 / font-smoothing.css
Created May 3, 2015 14:32
Applying font smoothing in WebKit based browsers and Firefox
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@kirang89
kirang89 / generate-CA.sh
Created April 19, 2015 21:32
Generates a self-signed certificate for Mosquitto
#!/bin/bash
#(@)generate-CA.sh - Create CA key-pair and server key-pair signed by CA
# Copyright (c) 2013 Jan-Piet Mens <jpmens()gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
@kirang89
kirang89 / Podfile
Last active August 29, 2015 14:17
An example Podfile to bootstrap your iOS application
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '7.0'
target '<App_name_here>' do
# Logging & Analytics
pod 'CocoaLumberjack', '~> 1.9.0'
pod 'CrashlyticsFramework'
pod 'CrashlyticsLumberjack', '~>1.0.0'

Keybase proof

I hereby claim:

  • I am kirang89 on github.
  • I am kirang (https://keybase.io/kirang) on keybase.
  • I have a public key whose fingerprint is 8171 2EF3 CFA3 89EA C7B2 E6E4 A809 7501 B863 A23A

To claim this, I am signing this object:

;
; Simple example to illustrate higher order procedures
;
(define (inc x) (+ x 1))
(define (cube x) (* x x x))
(define (even? x) (= (remainder x 2) 0))
@kirang89
kirang89 / ssl_client.py
Last active August 29, 2015 14:11
MQTT client to interact with a broker, with user authentication, using an SSL connection
#!/usr/bin/env python
import paho.mqtt.client as mqtt
import ssl
def on_connect(client, userdata, rc):
print("Connected with result code "+str(rc))
def on_message(client, data, msg):