Skip to content

Instantly share code, notes, and snippets.

View kaveenr's full-sized avatar
🐱
Getting stuff done.

Kaveen kaveenr

🐱
Getting stuff done.
View GitHub Profile
@kaveenr
kaveenr / flask_get.py
Created May 13, 2014 03:42
Python3 Flask GET request
from flask import Flask , render_template , request
app = Flask(__name__)
app.debug = True
@app.route('/')
def hello():
return "<h1>Hello World </h1>"
@app.route('/hello/<name>')
def name(name=None):
if name:
return render_template("hello.html",name = name)
@kaveenr
kaveenr / pyserial_example.py
Created May 13, 2014 03:44
PySerial Helper Class
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# pysbase.py
#
# Copyright 2013 Unknown <kaveenr@kaveenlabs>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@kaveenr
kaveenr / Asterixdb.yaml
Last active May 19, 2016 15:00
AsterixDB swagger IO
swagger: '2.0'
info:
title: New HTTP API for AsterixDB
description: more info https://cwiki.apache.org/confluence/display/ASTERIXDB/New+HTTP+API+Design
version: "1.0.0"
schemes:
- http
paths:
import urllib, urllib2, re, json, sys
count=0
null = ""
ch= sys.argv[1]
print ch
true = True
false = False
imgur=[]
accp = ['.JPG','.PNG']
try:
@kaveenr
kaveenr / shakespeare-insults.json
Last active January 18, 2017 17:59
shakespeare insult generator
[
["artless", "bawdy", "beslubbering", "bootless", "churlish", "cockered", "clouted", "craven", "currish", "dankish", "dissembling", "droning", "errant", "fawning", "fobbing", "froward", "frothy", "gleeking", "goatish", "gorbellied", "impertinent", "infectious", "jarring", "loggerheaded", "lumpish", "mammering", "mangled", "mewling", "paunchy", "pribbling", "puking", "puny", "qualling", "rank", "reeky", "roguish", "ruttish", "saucy", "spleeny", "spongy", "surly", "tottering", "unmuzzled", "vain", "venomed", "villainous", "warped", "wayward", "weedy", "yeasty"],
["base-court", "bat-fowling", "beef-witted", "beetle-headed", "boil-brained", "clapper-clawed", "clay-brained", "common-kissing", "crook-pated", "dismal-dreaming", "dizzy-eyed", "doghearted", "dread-bolted", "earth-vexing", "elf-skinned", "fat-kidneyed", "fen-sucked", "flap-mouthed", "fly-bitten", "folly-fallen", "fool-born", "full-gorged", "guts-griping", "half-faced", "hasty-witted", "hedge-born", "hell-hated", "idle-headed", "ill-breeding", "ill-n
[
{
"line": 1,
"elements": [
{
"line": 2,
"name": "Get the details of all atms owned by a bank",
"description": "",
"id": "get-atm-details;get-the-details-of-all-atms-owned-by-a-bank",
"type": "scenario",
Copyright (c) $today.year, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
WSO2 Inc. licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except
in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
@kaveenr
kaveenr / pom.xml
Last active January 13, 2019 03:47
Maven-codegen POM
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
@kaveenr
kaveenr / DefaultApiServiceImpl.java
Last active January 13, 2019 03:46
Maven-codegen Impl
/**
* Swagger Petstore
*
* <p>A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification
*
*/
public class DefaultApiServiceImpl implements DefaultApi {
static Map<Long,PetDTO> petMap = new HashMap<>();
@kaveenr
kaveenr / beans.xml
Created January 13, 2019 04:02
Maven-codegen beans
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<context:property-placeholder/>
<context:annotation-config/>
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer"/>
<bean class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer"/>
<jaxrs:server id="services" address="/v1/">
<jaxrs:serviceBeans>
<bean class="com.kaveenrodrigo.blog.codegen.sample.api.impl.DefaultApiServiceImpl"/>
</jaxrs:serviceBeans>