Skip to content

Instantly share code, notes, and snippets.

@vik-y
vik-y / IBMActivity.java
Created May 18, 2015 10:09
Normal API Call App
package com.example.bobo.sensorapp;
import android.content.Intent;
import android.os.AsyncTask;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@vik-y
vik-y / ibm.jsp
Created May 19, 2015 07:23
IBM first assignment JSP
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
@vik-y
vik-y / phpmyadmin_bluemix.txt
Created May 22, 2015 06:06
Setting up phpmyadmin on bluemix
Step 1:
git clone https://github.com/vik-y/cf-ex-phpmyadmin
Step 2:
Create a Clear DB Service on IBM Bluemix
Step 3:
Create a PHP application on bluemix, we'll upload phpmyadmin code in this application
Step 4:
@vik-y
vik-y / wordpress_bluemix.txt
Created May 22, 2015 06:18
Deploying Wordpress Blog on Bluemix
Go to IBM Bluemix Catalog
Use the Wordpress Boiler plate.
Download the Start code and upload it on Bluemix using cf push <app name>
That's it. Wordpress deployed.
@vik-y
vik-y / AlchemyNews.py
Created May 25, 2015 07:22
Alchemy News Api Call using python
'''
A basic implementation of calling Alchemy API using python.
I have used request library but you can use urllib too
'''
import requests
import json
from BeautifulSoup import BeautifulSoup
@vik-y
vik-y / RSA.py
Last active August 29, 2015 14:22 — forked from avalonalex/RSA.py
import random
from itertools import combinations
import math
import copy
def euclid(a, b):
"""returns the Greatest Common Divisor of a and b"""
a = abs(a)
b = abs(b)
@vik-y
vik-y / composer.json
Created May 30, 2015 15:00
A command line tool to parse json composer.json for testing how it works
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "4.2.*"
},
"autoload": {
@vik-y
vik-y / traceroute.py
Created May 31, 2015 19:04
From http://www.secdev.org/projects/scapy/doc/usage.html A lovely way to make traceroute graphs. Love it.
>>> res,unans = traceroute(["www.microsoft.com","www.cisco.com","www.yahoo.com","www.wanadoo.fr","www.pacsec.com"],dport=[80,443],maxttl=20,retry=-2)
Received 190 packets, got 190 answers, remaining 10 packets
193.252.122.103:443 193.252.122.103:80 198.133.219.25:443 198.133.219.25:80 207.46...
1 192.168.8.1 192.168.8.1 192.168.8.1 192.168.8.1 192.16...
2 82.251.4.254 82.251.4.254 82.251.4.254 82.251.4.254 82.251...
3 213.228.4.254 213.228.4.254 213.228.4.254 213.228.4.254 213.22...
[...]
>>> res.graph() # piped to ImageMagick's display program. Image below.
>>> res.graph(type="ps",target="| lp") # piped to postscript printer
>>> res.graph(target="> /tmp/graph.svg") # saved to file
@vik-y
vik-y / curl.sh
Created June 24, 2015 15:32
Some quick hacks regarding using curl
#http://curl.haxx.se/docs/httpscripting.html#GET Use this link for further reference
curl --referer http://www.example.come http://www.example.com
# To fake the referrer header
curl --location http://www.example.com
# To make curl follow the redirects as well
curl --upload-file uploadfile http://www.example.com/receive.cgi
@vik-y
vik-y / ApiConnectCode
Created July 11, 2015 12:28
hackathon android code
package APIConnect;
import android.util.Base64;
import android.util.Log;
import android.widget.Toast;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;