Skip to content

Instantly share code, notes, and snippets.

Ashu Gupta ashugupt

  • India
Block or report user

Report or block ashugupt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View f-4.sql
SELECT
b.cluster_name,
SUM(a.total_shipments) AS total_shipments
FROM (
SELECT
booking_cluster_id,
1 AS total_shipments
FROM shipment
WHERE 1=1
AND timestamp BETWEEN '{{ last_sunday }}'
View f-3.json
Message 1:
-----------
{
"after": {
"key1": "value1",
"key2": "value2",
"key3": "value3",
"created_at": 1
}
}
View f-2.json
{
"before": {
"shipment_id": 1,
"from": "Delhi",
"to": "Chennai",
"total_amount": 15600.00
},
"after": {
"shipment_id": 1,
"from": "Delhi",
View f-1.json
{
"before": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"after": {
"key1": "value1-modified",
"key2": "value2",
"key3": "value3-modified"
View quick-tips-optimizing-jvm.md

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

@ashugupt
ashugupt / gist:1d46fac48446f7c0408f9c8deab22c84
Last active Aug 28, 2017
Cleanup a git repository of unwanted files/history
View gist:1d46fac48446f7c0408f9c8deab22c84
# List all large blobs in a git repository sorted by blob size in descending order.
git rev-list --objects master | git cat-file --batch-check='%(objectsize) %(objecttype) %(objectname) %(rest)' | sort -k1,1 -rn > ~/Desktop/abc.txt
# Rewrite history removing history of a file
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch <path/to/unwanted/file>' \
--prune-empty --tag-name-filter cat -- --all
@ashugupt
ashugupt / pic_export.sc
Created Jul 24, 2015
Copies files from one directory tree to output
View pic_export.sc
import java.nio.file.{DirectoryStream, Files, Path, Paths}
import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer
val filesList = ArrayBuffer[String]()
var directoryStream =
Files.newDirectoryStream(Paths.get("/Users/ashugupt/Pictures/chandrataal"))
val outputJpegPath = Paths.get("/Users/ashugupt/Pictures/chandrataal/jpegs")
You can’t perform that action at this time.