Skip to content

Instantly share code, notes, and snippets.

View rsrini7's full-sized avatar
😃
Happy

Srinivasan Ragothaman rsrini7

😃
Happy
View GitHub Profile
@rsrini7
rsrini7 / Chat.after.js
Created March 17, 2019 09:50 — forked from elijahmanor/Chat.after.js
Code from Migrating from Unsafe React Lifecycle Hooks https://www.youtube.com/watch?v=G9S1IghlkCI
import React, { Component } from "react";
import Button from "./Button";
import Message from "./Message";
import { getMessage } from "./utils";
export default class Chat extends Component {
state = {
isStreaming: this.props.isStreaming,
messages: [getMessage()]
};
@rsrini7
rsrini7 / gist-reveal.it-slides.html
Created March 13, 2019 09:29 — forked from ryanj/gist-reveal.it-slides.html
Gist-powered Revealjs slideshow presentations http://gist-reveal.it
<section data-background-transition='zoom' data-transition='concave' data-background='http://ryanjarvinen.com/presentations/shared/img/broadcast_reveal_dark.png' data-state='blackout'>
<h2>Gist-Powered</h2>
<h1>Reveal.js</h1>
<h2>Slideshow Presentations</h2>
<br/>
<h1 class='fragment grow'><a style='color:deepskyblue;' href='http://gist-reveal.it'>gist-reveal.it</a></h1>
</section>
<section data-background-transition='zoom' data-transition='linear' id='try-it'>
<h2>Try it out!</h2>
<p>Create your own deck by forking a copy of <a href='https://gist.github.com/ryanj/af84d40e58c5c2a908dd'>this github gist</a>: <br /><a href='https://gist.github.com/ryanj/af84d40e58c5c2a908dd'>https://gist.github.com/ryanj/af84d40e58c5c2a908dd</a></p>
@rsrini7
rsrini7 / custom-conf_pom.xml
Created January 31, 2019 10:01 — forked from alexvictoor/custom-conf_pom.xml
Playing with jakarta commons configuration, reading external files
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.alexvictoor</groupId>
<artifactId>custom-conf</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>custom-conf</name>
@rsrini7
rsrini7 / FibCached.java
Created January 21, 2019 16:55 — forked from smillies/FibCached.java
Caching recursive functions
package java8.concurrent;
import java.math.BigInteger;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Executor;
import java.util.function.Function;
/**
/*******************************************************************************
* Copyright (c) 2013,2014 Rüdiger Herrmann, Sebastian Millies
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
* Sebastian Millies - increase type safety & simplify reflection by using enums
/*******************************************************************************
* Copyright (c) 2013 Rüdiger Herrmann
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rüdiger Herrmann - initial API and implementation
******************************************************************************/
@rsrini7
rsrini7 / Fibonacci.java
Created October 14, 2018 14:49 — forked from mtrojanowski/Fibonacci.java
An implementation of Fibonacci
private BigInteger f(int n, Map<Integer, BigInteger> cache) {
BigInteger result = cache.putIfAbsent(n, RESERVED);
if (result == null) {
int half = (n + 1) / 2;
CompletableFuture<BigInteger> completableFuture = new CompletableFuture<>();
CompletableFuture<BigInteger> futureResult = CompletableFuture.supplyAsync(() -> f(half - 1, cache));
futureResult.thenAcceptBothAsync(CompletableFuture.supplyAsync(
@rsrini7
rsrini7 / instructions.md
Created October 6, 2018 08:33 — forked from matthewjberger/instructions.md
How to Install OpenCV 3, OpenCV_Contrib, and nteract on Windows

Installing OpenCV on Windows

First open a powershell terminal install the scoop package manager:

iex (new-object net.webclient).downloadstring('https://get.scoop.sh')

Note: if you get an error you might need to change the execution policy (i.e. enable Powershell) with:

@rsrini7
rsrini7 / vs2017.json
Created October 6, 2018 05:12 — forked from matthewjberger/vs2017.json
Beginning of a scoop installer for visual studio 2017 community edition. Uninstall doesn't work
{
"version": "15.6.2",
"url": "https://aka.ms/vs/15/release/vs_community.exe",
"homepage": "https://www.visualstudio.com/",
"checkver": {
"url": "https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2017-relnotes",
"re": "Visual Studio 2017 version (\\d+\\.\\d+\\.\\d+)"
},
"autoupdate": {
"url": "https://aka.ms/vs/15/release/vs_community.exe"
@rsrini7
rsrini7 / AsynchronousCache.java
Created September 24, 2018 10:50 — forked from mblanc/AsynchronousCache.java
Decorator of net.sf.ehcache.Ehcache. This class is an equivalent of an asynchronous net.sf.ehcache.constructs.blocking.SelfPopulatingCache. All cache entry of this cache will be eternal AND will have a timeToLive. When an element is "expired" (time of cr
package ...;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import net.sf.ehcache.CacheException;