Skip to content

Instantly share code, notes, and snippets.

View tgkprog's full-sized avatar
🎉
Focusing

Tushar Kapila tgkprog

🎉
Focusing
View GitHub Profile
@tgkprog
tgkprog / memory1
Created March 9, 2015 08:15
Memory - function lcoals - get cleaned up?
package test;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
/**
Run with param 1 and 2 or change type to "2" and "1"
Available memory changes, used jconsole to change force garbage collection.
See video https://www.youtube.com/watch?v=MadBdryX8uk
@tgkprog
tgkprog / maintenance.sh
Last active May 23, 2016 17:11 — forked from Zoramite/maintenance.sh
Git Maintenance Commands
# Verifies the connectivity and validity of the objects in the database
git fsck —unreachable
# Manage reflog information
git reflog expire —expire=0 —all
# Pack unpacked objects in a repository
git repack -a -d -l
# Prune all unreachable objects from the object database
# Verifies the connectivity and validity of the objects in the database
git fsck
#—unreachable
# Manage reflog information
#git reflog expire —expire=0 —all
# Pack unpacked objects in a repository
git repack -a -d -l
@tgkprog
tgkprog / zep1
Last active December 28, 2016 18:31
zeppelin load file, input parameters and transform text
//** Should be a maven or gradle project and use 0.62 https://zeppelin.apache.org/download.html and scala 2.11, spark spark-2.0.1-bin-hadoop2.7
//** Your example should take 6 parameters so that can test 4 transformations including date. this example does not have date parsing.
//** parse a date using DateFormat and use that date to compare to a column (is equal) from file
import scala.util.matching.Regex
import org.apache.spark.sql.functions.udf
import org.apache.spark.sql.catalog.Column
def doRegReplace(orig: String, reg: Regex, rplc: String): String =
@tgkprog
tgkprog / Zeppelin-notebook-sample.txt
Last active January 5, 2017 10:56
Download and run Apache Zeppelin
// * Can copy paste this in to a new zeppelin notebook on http://localhost:8080/ presuming you got zeppelin to install and run
// * Your example should take 6 parameters so that can test 4 transformations including date. this example does not have date parsing.
// * parse a date using DateFormat and use that date to compare to a column (is equal) from file
val start = System.currentTimeMillis()
import scala.util.matching.Regex
import org.apache.spark.sql.functions.udf
import org.apache.spark.sql.catalog.Column
@tgkprog
tgkprog / build.gradle
Last active August 24, 2017 18:15
Gradle build with with code to put the git revision and other information using org.ajoberstar.grgit
plugins {
id "org.ajoberstar.grgit" version "1.5.1-rc.3"
}
apply plugin: 'java'
repositories {
///....
}
@tgkprog
tgkprog / keybase.md
Created December 6, 2017 18:54
key bs proof

Keybase proof

I hereby claim:

  • I am tgkprog on github.
  • I am tgkprog (https://keybase.io/tgkprog) on keybase.
  • I have a public key whose fingerprint is E61F 4669 3B6A 5B4F 965C 83BB D7A3 AA51 BE1C 1C1A

To claim this, I am signing this object:

On camera need to take 2-3 screen shots of face and then can switch off
Share your screen
Do not seach the internet for specifcally searching for this question, but can use if required for JS arrays/ loops. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Loops_and_iteration ; https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for ; https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
Extra marks if you can make input - one text box and button (simple validation is number >0 and <20) and output in a div it appear on a HTML page like in https://sel2in.com/pages/prog/html/js2/Zawgyi.html
Use Vanilla Javascrpt no frameworks.
Given n>=0, create an array length n*n with the following pattern, shown here for n=3 : {0, 0, 1, 0, 2, 1, 3, 2, 1} (spaces added to show the 3 groups).
@tgkprog
tgkprog / IcyHot.php
Created March 25, 2021 14:10
Php sample function with unit test cases
<?php
$count= 0;
$errs = 0;
/**
* Target function, this function is the main function to implement. The signature should be same as
in your question.
@tgkprog
tgkprog / docker1.txt
Created June 14, 2023 21:31
docker commands
Remove all containers, -v is to remove anonymouse volumes connected to that container as well. can add -f
sudo docker ps -a --format "{{.ID}}" | xargs -L1 sudo docker rm -v