Skip to content

Instantly share code, notes, and snippets.

View GDLMadushanka's full-sized avatar
😇

Lahiru Madushanka GDLMadushanka

😇
View GitHub Profile
@GDLMadushanka
GDLMadushanka / Deutsch–Jozsa.py
Created May 1, 2020 08:25
Deutsch–Jozsa algorithm
from matplotlib import pyplot as plt
import numpy as np
from qiskit import *
# Creating a circuit with 3 quantum bits and 2 classical bit
qc = QuantumCircuit(3,2)
# Preparing inputs
qc.h(0)
qc.h(1)
@GDLMadushanka
GDLMadushanka / Full-Adder.py
Created February 4, 2020 07:29
Full-Adder implementation using qiskit
from qiskit import *
from qiskit.tools.visualization import plot_bloch_multivector
from qiskit.tools.visualization import plot_histogram
# Creating a circuit with 8 quantum bits and 2 classical bits
qc = QuantumCircuit(8,2)
# Preparing inputs
qc.x(0) # Comment this line to make Qbit0 = |0>
qc.x(1) # Comment this line to make Qbit1 = |0>
@GDLMadushanka
GDLMadushanka / OR-gate.py
Created February 4, 2020 06:40
Quantum OR gate
from qiskit import *
from qiskit.tools.visualization import plot_bloch_multivector
from qiskit.tools.visualization import plot_histogram
# Creating a circuit with 3 quantum bits and one classical bit
qc = QuantumCircuit(3,1)
# Preparing inputs
qc.x(0) # Comment this line to make Qbit0 = |0>
qc.x(1) # Comment this line to make Qbit1 = |0>
@GDLMadushanka
GDLMadushanka / Half-Adder.py
Created February 4, 2020 06:19
Half-Adder implementation using qiskit
from qiskit import *
from qiskit.tools.visualization import plot_bloch_multivector
from qiskit.tools.visualization import plot_histogram
# Creating a circuit with 3 quantum bits and 2 classical bits
qc = QuantumCircuit(3,2)
# Preparing inputs
qc.x(0) # Comment this line to make Qbit0 = |0>
qc.x(1) # Comment this line to make Qbit1 = |0>
@GDLMadushanka
GDLMadushanka / AND_CCNOT.py
Created February 4, 2020 05:41
AND gate using CCNOT
from qiskit import *
from qiskit.tools.visualization import plot_bloch_multivector
from qiskit.tools.visualization import plot_histogram
# Creating a circuit with 3 quantum bits and one classical bit
qc = QuantumCircuit(3,1)
# Preparing inputs
qc.x(0) # Comment this line to make Qbit0 = |0>
qc.x(1) # Comment this line to make Qbit1 = |0>
@GDLMadushanka
GDLMadushanka / XOR_CNOT.py
Created February 4, 2020 02:13
XOR implementation using CNOT gate
from qiskit import *
from qiskit.tools.visualization import plot_bloch_multivector
from qiskit.tools.visualization import plot_histogram
# Creating a circuit with 2 quantum bits and one classical bit
qc = QuantumCircuit(2,1)
# Preparing inputs
qc.x(0) # Comment this line to make Qbit0 = |0>
qc.x(1) # Comment this line to make Qbit1 = |0>
@GDLMadushanka
GDLMadushanka / testJSONTransform.xml
Created December 29, 2019 16:12
Sample proxy service to test JSON Transform mediator
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="testJSONTransform" startOnLoad="true" statistics="disable" trace="disable" transports="http,https">
<target>
<inSequence>
<jsontransform schema="conf:/schema.json"/>
<respond/>
</inSequence>
</target>
<description/>
</proxy>
@GDLMadushanka
GDLMadushanka / schema.json
Created December 29, 2019 15:48
JSON schema to test JSON Transform mediator
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"fruit": {
"type": "string",
"minLength": 4,
"maxLength": 6,
"pattern": "^[0-9]{1,45}$"
},
@GDLMadushanka
GDLMadushanka / BlogScraper.go
Created October 10, 2019 14:51
A GO program that fetch blog of a given moth from Wordpress and Medium.
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"strings"
@GDLMadushanka
GDLMadushanka / input.json
Created October 10, 2019 14:49
This file will be read, parsed and used as inputs in the GO code.
{
"Year" : "2019",
"Month" : "Sep",
"Blogs" : [
"https://medium.com/feed/@madushandhanushka",
"https://medium.com/feed/@arunans23",
"https://medium.com/feed/@isuruuy",
"https://medium.com/feed/@jayawark",
"https://medium.com/feed/@a5anka",
"https://medium.com/feed/@chanika1118",