Skip to content

Instantly share code, notes, and snippets.

View rahulpandey's full-sized avatar

Rahul rahulpandey

  • Reward360 Global Services
  • Bengaluru
View GitHub Profile
# Display last month commit of author
git log --since='last month' --pretty=format:' %Cred%h%Creset ; %C(bold blue)%an%Creset ; %C(yellow)%ad%Creset ; %Cgreen%s%Creset ' --date=format:'%Y-%m-%d %H:%M:%S' --author=AUTHOR_NAME
@rahulpandey
rahulpandey / MyDateTimePickerDialogFragment.kt
Last active May 20, 2019 06:52
Date time picker android
package com.example.myapplication
import android.app.AlertDialog
import android.app.Dialog
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.LayoutInflater
import androidx.fragment.app.DialogFragment
@rahulpandey
rahulpandey / aws-ubuntu-adavance.sh
Created September 21, 2017 07:44
Aws instance ec2
#!/bin/bash
apt-get update
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 80 -j ACCEPT
@rahulpandey
rahulpandey / settings.json
Created June 13, 2017 04:28
template vs code
{
"editor.fontFamily": "Monaco, 'Courier New', monospace",
"workbench.colorTheme": "Darcula Theme from IntelliJ",
"editor.tabSize": 2,
"react.beautify.onSave": true,
"editor.formatOnSave": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
String hexColor = String.format("#%06X", (0xFFFFFF & -16776961));
Integer intColor = -16895234;
String hexColor = "#" + Integer.toHexString(intColor).substring(2);
@rahulpandey
rahulpandey / PushClass.java
Last active April 17, 2017 10:28
An efficient utility class for sending Apple push notification (Apns) over HTTP 2.0
import java.io.FileInputStream;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.Arrays;
ColorDrawable drawable=new ColorDrawable();
drawable.setColor(getResources().getColor(R.color.colorPrimary));
drawable.setAlpha(-verticalOffset * 255 / appBarLayout.getTotalScrollRange());
toolbar.setBackground(drawable);
1.Copy postgresql jar glassfish4/glassfish/domains/domain1/lib/ext
2.start glassfish
asadmin start-domain
3.Create Connection Pool (DataSource)
asadmin create-jdbc-connection-pool
--datasourceclassname org.postgresql.ds.PGSimpleDataSource
--restype javax.sql.DataSource
--property user=USER_NAME:password=PASSWORD:DatabaseName=DB_NAME:ServerName=HOST_NAME:port=PORT_NAME
postgresql-pool(DataSource Name)
mdpi @ 1.00dp = 1.00px
hdpi @ 1.00dp = 1.50px
xhdpi @ 1.00dp = 2.00px
xxhdpi @ 1.00dp = 3.00px
xxxhdpi @ 1.00dp = 4.00px
//TabLayout text color selector when using cutom view
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Active tab -->
<item android:color="@android:color/holo_red_dark" android:state_focused="false" android:state_pressed="false" android:state_selected="true" />
<!-- Inactive tab -->
<item android:color="#000" android:state_focused="false" android:state_pressed="false" android:state_selected="false" />
<!-- Pressed tab -->
<item android:color="#000" android:state_pressed="true" />