Skip to content

Instantly share code, notes, and snippets.

View hackintoshrao's full-sized avatar
📚
Exploring AI agents on code search and understanding

Karthic Rao hackintoshrao

📚
Exploring AI agents on code search and understanding
View GitHub Profile
## Read the reviews first.
g = open('reviews.txt','r') # What we know!
reviews = list(map(lambda x:x[:-1],g.readlines()))
g.close()
g = open('labels.txt','r') # What we WANT to know!
labels = list(map(lambda x:x[:-1].upper(),g.readlines()))
g.close()
from collections import Counter
version: '2'
services:
my-test-server:
image: nginx
ports:
- "80:80"
volumes:
- my-test-store:/usr/share/nginx/html:ro
volumes:
package main
import (
"flag"
"fmt"
"os"
"os/exec"
"path/filepath"
"strconv"
@hackintoshrao
hackintoshrao / simple_neural.py
Created February 2, 2017 05:25
simplest neural network
import numpy as np
def sigmoid(x):
# sigmoid function
return 1/(1+np.exp(-x))
inputs = np.array([0.7, -0.3])
weights = np.array([0.1, 0.8])
bias = -0.1
@hackintoshrao
hackintoshrao / linear_regresssion.py
Created January 29, 2017 02:32
Doing linear regression using python.
# TODO: Add import statements
import pandas as pd
from sklearn import linear_model
# Assign the dataframe to this variable.
# TODO: Load the data
bmi_life_data = pd.read_csv("bmi_and_life_expectancy.csv")
# Make and fit the linear regression model
Country Life expectancy BMI
Afghanistan 52.8 20.62058
Albania 76.8 26.44657
Algeria 75.5 24.5962
Andorra 84.6 27.63048
Angola 56.7 22.25083
Armenia 72.3 25.355420000000002
Australia 81.6 27.56373
Austria 80.4 26.467409999999997
Azerbaijan 69.2 25.65117
package main
import (
"github.com/docker/go-plugins-helpers/volume"
)
const (
sshfsID = "_sshfs"
socketAddress = "/run/docker/plugins/my-dummy-fs.sock"
)
// Driver represent the interface a driver must fulfill.
type Driver interface {
Create(Request) Response
List(Request) Response
Get(Request) Response
Remove(Request) Response
Path(Request) Response
Mount(MountRequest) Response
Unmount(UnmountRequest) Response
Capabilities(Request) Response
@hackintoshrao
hackintoshrao / extend-minfs-docker.sh
Created January 19, 2017 03:56
Extending Minfs docker container to use Minfs.
# fetch code.
$ go get github.com/minio/minfs
# cd to directory.
$ cd $GOPATH/src/github.com/minio/minfs
# build the docker container for Minfs.
$ docker build minio/minfs .
# Run Minfs Docker container.
@hackintoshrao
hackintoshrao / use-minfs.sh
Last active January 19, 2017 03:35
How a Dockerized application make use of Minfs.
# Install fuse on the host.
$ sudo apt-get install fuse
# On host - Fetch and builds Minfs.
$ go get github.com/minio/minfs
# On host - Set Access and Secret Key of the Minio server.
$ export MINFS_ACCESS_KEY=Q3AM3UQ867SPQQA43P2F
$ export MINFS_SECRET_KEY=zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG