Skip to content

Instantly share code, notes, and snippets.

View SubhrajyotiSen's full-sized avatar

Subhrajyoti Sen SubhrajyotiSen

View GitHub Profile

Oh my zsh.

Install with curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Enabling Plugins (zsh-autosuggestions & zsh-syntax-highlighting)

  • Download zsh-autosuggestions by
@ngengs
ngengs / h5ai_item_click_count.js
Created June 28, 2016 17:45
h5ai external script to detect item click, and push to google analytic
if(window.jQuery){
//run when window ready
$(window).ready(function(){
//detect item click
$('body').on('click','.item.file>a',function(e){
var f=$(this);
// Test the function, print the download/clicked file to console
console.log("Downloading:"+f.context.href);
ga('send', 'event', 'File Sharing', 'Download', f.context.href);
})
public String getTimestamp() {
DateTime post = new DateTime(1468973396572);
DateTime now = new DateTime();
Period period = new Period(post, now);
PeriodFormatter formatter;
if(period.getYears() != 0){
formatter = new PeriodFormatterBuilder().appendYears().appendSuffix("Y").printZeroNever().toFormatter();
}else if(period.getMonths() !=0){
@varhub
varhub / Android - Enable ADB from recovery.md
Created December 23, 2016 17:54
Android - Enable ADB from recovery

Android - Enable ADB from recovery

Credits to @TheOnlyAnil-@Firelord[^stackoverflow]

  • Requirements: a) stock recovery + rooted phone b) custom recovery

  • Files changed:

@RealDeanZhao
RealDeanZhao / parse-inputstream-to-jsonobject.md
Created April 10, 2017 06:00
Parse InputStream to JsonObject
JsonObject json;
  try {
    JsonElement element = new JsonParser().parse(
    new InputStreamReader(responseEntity.getBody().getInputStream())
  );
  json = element.getAsJsonObject();
} catch (IOException e) {
  throw new RuntimeException(e.getLocalizedMessage());
}
@msfjarvis
msfjarvis / sepolicy.md
Last active December 20, 2024 23:32
How to write sepolicy to fix a denial
@Atlas7
Atlas7 / entropy-cost.md
Last active October 5, 2022 05:31
Deep Neural Network - cross entropy cost - np.sum vs np.dot styles

Cross Entropy Cost and Numpy Implementation

Given the Cross Entroy Cost Formula:

cross-entroy-cost-function.png

where:

  • J is the averaged cross entropy cost
  • m is the number of samples
  • super script [L] corresponds to output layer
@florina-muntenescu
florina-muntenescu / BaseDao.kt
Last active October 11, 2024 01:20
Use Dao inheritance to reduce the amount of boilerplate code - https://medium.com/google-developers/7-pro-tips-for-room-fbadea4bfbd1
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ValCanBuild
ValCanBuild / BottomNavigationBehavior.kt
Last active December 18, 2023 00:04
Full code of a BottomNavigationBehavior which hides itself on scroll and handles Snackbars, FAB and snapping. https://medium.com/@ValCanBuild/scroll-your-bottom-navigation-view-away-with-10-lines-of-code-346f1ed40e9e
/**
MIT License
Copyright (c) 2018 Valentin Hinov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@MeNiks
MeNiks / RealPathUtil.kt
Last active July 10, 2024 08:57
Kotlin code to get real path / sd card path from intent data while browsing file.
import android.annotation.SuppressLint
import android.content.ContentUris
import android.content.Context
import android.content.CursorLoader
import android.database.Cursor
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.provider.DocumentsContract
import android.provider.MediaStore