This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gets LTP from ICICI Direct. | |
* | |
* @param {string} symbol Symbol for this Last Traded Price is required | |
* @return {string} ltp Current LTP from ICICI Direct | |
* @customfunction | |
*/ | |
function ILTP(symbol) { | |
var url = 'https://secure.icicidirect.com/IDirectTrading/Trading/trading_stock_quote.aspx?Symbol=' + symbol | |
console.log('URL :' + url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# <bitbar.title>Countdown Timer</bitbar.title> | |
# <bitbar.version>v1.0</bitbar.version> | |
# <bitbar.author>Chris Yuen</bitbar.author> | |
# <bitbar.author.github>kizzx2</bitbar.author.github> | |
# <bitbar.desc>Simple countdown timer. Set the time by calling the script from terminal.</bitbar.desc> | |
# <bitbar.dependencies>ruby</bitbar.dependencies> | |
# <bitbar.image>https://raw.githubusercontent.com/kizzx2/bitbar-countdown-timer/master/screenshot.png</bitbar.image> | |
# <bitbar.abouturl>http://github.com/kizzx2/bitbar-countdown-timer</bitbar.abouturl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Given a rod of length n inches and a table of prices pi for i D 1; 2; : : : ; n, | |
//determine the maximum revenue rn obtain- able by cutting up the rod and selling the pieces. | |
//Note that if the price pn for a rod of length n is large enough, an optimal solution may require no cutting at all. | |
//Comlexity : O(n^2) | |
//run: node rodcutting.js 5 | |
//debug: node-inspector && node --debug-brk rodcutting.js | |
var priceData = { | |
1: 1, | |
2: 5, | |
3: 8, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample file to generate input for sorting | |
from datetime import datetime | |
from random import sample | |
import sys | |
class seeddata(): | |
def genrateRandomDataTill(self, limit): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.vivek.j2ee.websockets.client; | |
import org.glassfish.tyrus.client.ClientManager; | |
import javax.websocket.ClientEndpointConfig; | |
import javax.websocket.CloseReason; | |
import javax.websocket.DeploymentException; | |
import javax.websocket.Session; | |
import java.io.IOException; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
import java.util.Scanner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.vivek.j2ee.websockets.client; | |
import javax.websocket.*; | |
import java.io.IOException; | |
import java.nio.ByteBuffer; | |
public class ClientWebSocketEndpoint extends Endpoint { | |
@Override public void onOpen(final Session session, EndpointConfig config) { | |
try { | |
session.getBasicRemote().sendText("Joining"); | |
} catch (IOException e) { | |
e.printStackTrace(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.vivek.j2ee.websockets.server; | |
import org.glassfish.tyrus.server.Server; | |
import javax.websocket.DeploymentException; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
public class WebSocketServerWrapper { | |
public static void main(String args[]) { | |
runServer(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.vivek.j2ee.websockets.server; | |
import javax.websocket.CloseReason; | |
import javax.websocket.OnClose; | |
import javax.websocket.OnMessage; | |
import javax.websocket.Session; | |
import javax.websocket.server.ServerEndpoint; | |
import java.io.IOException; | |
import java.util.LinkedList; | |
import java.util.List; | |
@ServerEndpoint(value = "/echo") public class EchoWebSocketEndPoint { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# (1) copy to: ~/bin/ssh-host-color | |
# (2) set: alias ssh=~/bin/ssh-host-color | |
# | |
# Inspired from http://talkfast.org/2011/01/10/ssh-host-color | |
# Fork from https://gist.github.com/773849 | |
# | |
set_term_bgcolor(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Answer28 { | |
private static long dividend = 1; | |
private static long divisor = 1; | |
public static long divideOne(long dividend, long divisor) { | |
long quotient = 0; |
NewerOlder