Skip to content

Instantly share code, notes, and snippets.

View adeekshith's full-sized avatar

Deekshith Allamaneni adeekshith

View GitHub Profile
@adeekshith
adeekshith / Dockerfile
Last active May 30, 2024 21:30
Dockerfile to setup
# Use the Jupyter Data Science Notebook base image
FROM jupyter/datascience-notebook
# Install Node.js and npm
USER root
# Install Node.js and npm
RUN wget -qO- https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
@adeekshith
adeekshith / worldtime.sh
Created November 16, 2023 23:06
WorldTime - Show time in different timezones in the commandline
#!/bin/bash
echo "UTC: $(TZ='UTC' date +'%H:%M %Y-%m-%d %a')"
echo "-------------------------"
echo "EST: $(TZ='America/New_York' date +'%H:%M %Y-%m-%d %a')"
echo "CST: $(TZ='America/Chicago' date +'%H:%M %Y-%m-%d %a')"
echo "PST: $(TZ='America/Los_Angeles' date +'%H:%M %Y-%m-%d %a')"
echo "-------------------------"
echo "IST: $(TZ='Asia/Kolkata' date +'%H:%M %Y-%m-%d %a')"
# Ref: Timezone abbreviations: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
@adeekshith
adeekshith / 121-leetcode-best-time-to-buy-stock.java
Created September 29, 2022 00:28
121. Best time to buy Stock problem
class Solution {
public int maxProfit(int[] prices) {
int maxProfit = 0;
int prevBuy = Integer.MAX_VALUE;
int maxSellPrice = Integer.MIN_VALUE;
for (int buyDay=0; buyDay < prices.length; buyDay++) {
int buyPrice = prices[buyDay];
if (buyPrice >= prevBuy && maxSellPrice >= buyPrice) {
continue;
}
@adeekshith
adeekshith / parseflags.sh
Created October 14, 2020 14:58 — forked from bxparks/parseflags.sh
Simple Bash Shell Command Line Processing Template
#!/bin/bash
#
# Self-contained command line processing in bash that supports the
# minimal, lowest common denominator compatibility of flag parsing.
# -u: undefined variables is an error
# -e: exit shell on error
set -eu
function usage() {
@adeekshith
adeekshith / keybase.md
Created December 15, 2017 16:00
Used for keybase authentication

Keybase proof

I hereby claim:

  • I am adeekshith on github.
  • I am adeekshith (https://keybase.io/adeekshith) on keybase.
  • I have a public key ASDaFYYNIw727fCxfwv9n9rKdpw8eTJcPUGzxQe1uZ2QuQo

To claim this, I am signing this object:

@adeekshith
adeekshith / custom-search-search-engines.json
Created January 20, 2017 15:51
Sample search engines collection for Custom Search Webextension
{
"application" : {
"name" : "Custom Search",
"app_id" : "[email protected]",
"version" : "v0.1"
},
"search_engines" : [
{
"category": "General",
"name": "DuckDuckGo",
@adeekshith
adeekshith / IntegerTest.java
Created June 1, 2016 03:33
Testing performance between `Integer == int` vs `int == Integer`
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
public class IntegerTest {
public static void main(String[] args) {
long startTime;
long duration;
long endTime;
@adeekshith
adeekshith / .git-commit-template.txt
Last active October 20, 2024 21:10 — forked from Linell/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@adeekshith
adeekshith / cURL-every-URL-in-file.sh
Created November 6, 2015 04:50
Applies cURL on every URL in the given file and saves by line number. Each line in the input file should be a URL
#!/bin/bash
lineNum=1
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "Processing line $lineNum : $line"
curl -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3" $line -o scraped-html/$lineNum.html
delayNow=$((RANDOM%10*30+RANDOM%10))
echo "Waiting for $delayNow sec"
sleep $delayNow
lineNum=$((lineNum+1))
done < "$1"
@adeekshith
adeekshith / simple-website-monitor.nb
Created May 5, 2015 02:31
Simple website monitoring script in Mathematica to monitor and visualize any given website performance over time.
(* Monitors given website load time and plots it *)
dataLength = 400;
timeTakenUrlReq :=
First@AbsoluteTiming[Import["http://google.com/"]];
timeTakenTime := {DateList[], timeTakenUrlReq};
data = {timeTakenTime};
Dynamic[Last[AppendTo[data, timeTakenTime]], UpdateInterval -> 10,
TrackedSymbols -> {}]
Dynamic[If[Length[data] < dataLength, Length[data = data],
Length[data = data[[-dataLength ;;]]]]]