Skip to content

Instantly share code, notes, and snippets.

View alivcor's full-sized avatar
🌴
I may be slow to respond.

Abhinandan Dubey alivcor

🌴
I may be slow to respond.
View GitHub Profile
@alivcor
alivcor / randPartition.py
Last active September 18, 2017 04:07
Random Indices for train and test
import numpy as np
import random
def randPartition(alldata_X, alldata_Y, _FRACTION):
"""
alldata_X : All of your X (Features) data
alldata_Y : All of your Y (Prediction) data
_FRACTION : The fraction of data rows you want for train (0.75 means you need 75% of your data as train and 25% as test)
"""
@arshrahman
arshrahman / SortingAlgorithms.java
Last active April 23, 2023 15:25
Sorting Algorithms in Java - Selection Sort, Bubble Sort, Insertion Sort, Merge Sort, Quick Sort, Binary Search
import java.util.Arrays;
/*
Developed by Abdul Rahman
*/
public class SortingAlgorithms {
public static void main(String[] args) {
int[] array = {2, 3, 5, 7, 11, 13, 17, 19};
@omaraflak
omaraflak / main.cpp
Last active March 23, 2024 14:44
Image convolution in C++ + Gaussian blur
#include <iostream>
#include <vector>
#include <assert.h>
#include <cmath>
#include <png++/png.hpp>
using namespace std;
typedef vector<double> Array;
typedef vector<Array> Matrix;
@sbcd90
sbcd90 / spark-logical-plan-serializer-deserializer.scala
Created March 10, 2016 02:24
Spark-Logical-Plan-Serializer-Deserializer
package org.apache.spark.sql
import java.io.ByteArrayOutputStream
import com.esotericsoftware.kryo.io.Input
import org.apache.hadoop.io.{NullWritable, BytesWritable}
import org.apache.spark.rdd.RDD
import org.apache.spark.serializer.KryoSerializer
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.{SparkContext, SparkConf}
@vasanthk
vasanthk / System Design.md
Last active June 21, 2024 20:21
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@avtomaton
avtomaton / ec2-cuda-setup.bash
Last active June 17, 2020 21:10
amazon AMI CUDA setup
#!/bin/bash
NVIDIA_DRIVER_VERSION=352.63
NVIDIA_CUDA_VERSION=7.5
NVIDIA_CUDA_FULL_VERSION=7.5.18
sudo yum update -y
sudo yum groupinstall -y "Development tools"
sudo yum install kernel-devel-`uname -r`
@raelg
raelg / gist:e12d731ba01ba58f0006
Created January 20, 2015 16:44
Scala Gson Serializer
package services
import java.lang.reflect.Type
import com.google.gson._
import org.joda.time.format.ISODateTimeFormat
import org.joda.time.{DateTime, DateTimeZone}
object Serializers {