Skip to content

Instantly share code, notes, and snippets.

View apoorvam's full-sized avatar
💭
Love to code!

Apoorva Manjunath apoorvam

💭
Love to code!
View GitHub Profile
@apoorvam
apoorvam / weighted_collection.java
Created September 15, 2020 14:11
Choose random number of elements from collection with weights
import java.util.Collections;
import java.util.List;
import java.util.Arrays;
import java.util.NavigableMap;
import java.util.Random;
import java.util.TreeMap;
public class WeightedCollection {
private NavigableMap<Integer, String> map = new TreeMap<Integer, String>();
ALTER TABLE xbox_data.3on3_freestyle modify column recordTime datetime;
ALTER TABLE xbox_data.3on3_freestyle RENAME COLUMN recordTime TO record_time;
ALTER TABLE xbox_data.beatsplosion_for_kinect modify column recordTime datetime;
ALTER TABLE xbox_data.beatsplosion_for_kinect RENAME COLUMN recordTime TO record_time;
ALTER TABLE xbox_data.brawlhalla modify column recordTime datetime;
ALTER TABLE xbox_data.brawlhalla RENAME COLUMN recordTime TO record_time;
ALTER TABLE xbox_data.fishing_planet modify column recordTime datetime;
@apoorvam
apoorvam / mac_setup.sh
Created July 19, 2019 10:03
Setup new mac machine
#!/bin/sh
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew install tree go dep
@apoorvam
apoorvam / pom.xml
Created November 18, 2016 06:17
Dependencies for Gauge-Groovy project. http://getgauge.io
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sample</groupId>
<artifactId>demo</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
@apoorvam
apoorvam / README.md
Last active November 9, 2016 16:16
Shokunin November Code Challenge: Ghouls in Urn

Ghouls in Urn

An urn contains an unknown number of ghouls. However, it is known that half of the ghouls are white, and half of the ghouls are black. Three random ghouls are drawn from the urn without replacement to make a potion so strong it will turn a person into a chicken.

Challenge

Given an input which is the probability of all 3 ghouls being white, write a function to calculate the number of ghouls in the urn.

You can use this data to test your function

  • A 5% probability of all 3 ghouls being white, should have 6 ghouls in the urn.
@apoorvam
apoorvam / Impl.java
Created March 10, 2016 11:34
How to use Gauge with Soft Assertions
import com.thoughtworks.gauge.Step;
import org.assertj.core.api.SoftAssertions;
import java.util.ArrayList;
import java.util.Arrays;
public class Impl {
private ArrayList<String> vowels = new ArrayList<String>(Arrays.asList("a", "e", "i", "o", "u"));
private SoftAssertions softly = new SoftAssertions();
@apoorvam
apoorvam / SimpleInterest.java
Created February 9, 2016 12:18
Table Driven Execution in Gauge
import com.thoughtworks.gauge.Step;
import static org.junit.Assert.assertEquals;
public class SimpleInterest {
private int principal;
private int tenure;
private int roi;
@Step("Simple Interest for principal <principal> tenure <tenure> and roi <roi> is <interest>")
@apoorvam
apoorvam / example.go
Created December 8, 2015 08:07
Print long messages using uilive, to show progress
package main
import (
"fmt"
"time"
"github.com/gosuri/uilive"
)
func main() {
@apoorvam
apoorvam / console.go
Created December 1, 2015 11:27
Write to Console with colors
package main
import (
ct "github.com/daviddengcn/go-colortext"
"fmt"
"time"
"github.com/gosuri/uilive"
)
func main() {
@apoorvam
apoorvam / StepImplementation.java
Last active April 30, 2018 11:54
Gauge Sample Spec with Hooks at all levels.
import com.thoughtworks.gauge.*;
import java.util.ArrayList;
public class StepImplementation {
@BeforeSuite
public void beforeSuite(){
System.out.println("in before suite");
}