Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

/**
* 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);
@wnds
wnds / countdown.rb
Created April 22, 2018 15:55
Ruby Gist for bitbar countdown timer
#!/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>
//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,
# Sample file to generate input for sorting
from datetime import datetime
from random import sample
import sys
class seeddata():
def genrateRandomDataTill(self, limit):
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;
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();
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();
}
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 {
#!/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(){
@wnds
wnds / Answer28.java
Last active December 19, 2015 07:39
Perform Integer Division Without Using Either the / or * Operators
public class Answer28 {
private static long dividend = 1;
private static long divisor = 1;
public static long divideOne(long dividend, long divisor) {
long quotient = 0;