Skip to content

Instantly share code, notes, and snippets.

View mananshr's full-sized avatar
👋
Working on smart retail tech

Manan Sharma mananshr

👋
Working on smart retail tech
View GitHub Profile
@mananshr
mananshr / profile.ps1
Last active October 26, 2024 11:00
My standard MS PowerShell profile
### PowerShell profile template - Manan Sharma
###
### https://gist.github.com/mananshr/be2a248d1e34e52a77d0be37ffcd7fb4
###
### Source credits: Tim Sneath <tim@sneath.org>
### Forked from https://gist.github.com/timsneath/19867b12eee7fd5af2ba
###
### This file should be stored in $PROFILE.CurrentUserAllHosts
### If $PROFILE.CurrentUserAllHosts doesn't exist, you can make one with the following:
### PS> New-Item $PROFILE.CurrentUserAllHosts -ItemType File -Force
@mananshr
mananshr / commit_message_template.txt
Created July 1, 2023 18:31
Git commit template to improve your project's commit messages.
##################################################
# Write a title summarizing what this commit does.
# Start with an uppercase imperative verb, such as
# Add, Drop, Fix, Refactor, Bump; see ideas below.
# Think of your title as akin to an email subject,
# so you don't need to end with a sentence period.
# Use 50 char maximum, which is this line's width.
##################################################
Add your title here
@mananshr
mananshr / latency.txt
Created June 26, 2023 18:03 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@mananshr
mananshr / Vanilla_learn.js
Created February 27, 2023 16:29
Learning Vanilla JS
import "./styles.css";
document.getElementById("app").innerHTML = `
<h1>Hello Vanilla!</h1>
<div>
We use the same configuration as Parcel to bundle this sandbox, you can find more
info about Parcel.
</div>
`;
@mananshr
mananshr / AnimatedGifEncoder.java
Created September 28, 2016 14:37
An animated GIF encoder for Android, without any native code required. Based on the J2ME encoder. Additionally contain dirty triangle support.
package com.gokrazee.app.util.gif;
import java.io.IOException;
import java.io.OutputStream;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Paint;
package com.merevik.countingtextview;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.animation.LinearInterpolator;
import android.widget.TextView;
@mananshr
mananshr / GetMapFromArray.java
Last active April 4, 2016 09:13
Convert ArrayList to Map. One of the attributes of array list type <V> is used as key <K>, [ K ∈ V ] of the map. The important thing here is that the keys are sorted in the map.
public HashMap<K, ArrayList<V>> getMap(ArrayList<V> vs) {
ArrayList<K> keys = new ArrayList<>();
Iterator<V> iterator = vs.iterator();
while (iterator.hasNext()) {
V v = iterator.next();
if (!keys.contains(v.getV())) {
keys.add(v.getV());
}
}
@mananshr
mananshr / CountingFileRequestBody.java
Created October 8, 2015 13:12 — forked from eduardb/CountingFileRequestBody.java
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
@mananshr
mananshr / jQuery JavaScript Library
Created October 4, 2014 13:25
jQuery JavaScript Library Modified specifically for some projects
/*!
* jQuery JavaScript Library v2.1.1
* Mod 0.2.1
* http://jquery.com/
*
*http://stackoverflow.com/users/2043419/manan-merevik-sharma
*
* Includes Sizzle.js
* http://sizzlejs.com/
*