Skip to content

Instantly share code, notes, and snippets.

View gopinath-langote's full-sized avatar
💻
Focusing

Gopinath Langote gopinath-langote

💻
Focusing
View GitHub Profile
class Algo {
//Uxr@yjA9!mvKMNpDpn.-
// number of decodings
//
public int numDecodings(String s) {
if(s.startsWith("0")) {
return 0;
}
int[] count = new int[s.length() + 1];
count[0] = 1;
#!/bin/bash
pushd /tmp/
curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \
| grep "browser_download_url.*hugo_[^extended].*_Linux-64bit\.tar\.gz" \
| cut -d ":" -f 2,3 \
| tr -d \" \
| wget -qi -
@gopinath-langote
gopinath-langote / start_docker_if_needed_mac.sh
Last active June 18, 2019 11:37
Start docker on mac if already not running
#!/bin/bash
function run_docker_on_mac_if_not_running() {
echo "docker starting"
if (! docker stats --no-stream ); then
echo "Opening docker"
# Change location of app if different
open /Applications/Docker.app
# Wait until Docker daemon is running and has completed initialisation
while (! docker stats --no-stream ); do
data class Date(
var day: Int,
var month: Int,
var year: Int
)
@gopinath-langote
gopinath-langote / ConsecutiveDuplicates.sc
Created March 20, 2018 07:10
Eliminate consecutive duplicates of list elements
object ConsecutiveDuplicates {
def compress(xs: List[Char]): List[Char] = xs match {
case Nil => Nil
case _ :: Nil => xs
case x :: y :: rest => if (x == y) compress(y :: rest) else x :: compress(y :: rest)
}
def main(args: Array[String]): Unit = {
val chars = List('a', 'a', 'a', 'a', 'b', 'c', 'c', 'a', 'a', 'd', 'e', 'e', 'e', 'e')
@gopinath-langote
gopinath-langote / Geeky Dev Tools for mac
Last active January 4, 2018 06:35
Geeky Dev Tools for MAC
- ShiftIt - window manage
- Evernote
- flux - yellow screen
- shazam - music surround
- spotify
- caffine - No sleep for mac
- ccmenu - GOCD plugin
- alfred - shortcut for opening things.
- flycut - multiple copy paster
@gopinath-langote
gopinath-langote / git_serve.sh
Created September 11, 2017 05:44
Git serve patches
#!/bin/bash
echo "git pull --rebase git://`ipconfig getifaddr en0`/`basename $PWD` `git symbolic-ref --short HEAD`"
git daemon --base-path=.. --informative-errors --verbose --export-all
@gopinath-langote
gopinath-langote / EnumListExample.java
Created August 22, 2017 04:40
Put different type of enum in a list - JAVA
package com.javaexample;
import java.util.ArrayList;
import java.util.List;
import static com.javaexample.EnumListExample.MeasureType.M1;
import static com.javaexample.EnumListExample.MeasureType.M2;
import static com.javaexample.EnumListExample.UnitType.U1;
import static com.javaexample.EnumListExample.UnitType.U2;