Skip to content

Instantly share code, notes, and snippets.

@sungitly
sungitly / pom.xml
Last active December 30, 2015 05:29
pom.xml file for a sandbox project
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.sandbox</groupId>
<artifactId>sandbox</artifactId>
<version>1.0</version>
@sungitly
sungitly / oracle_utilities.sql
Created December 5, 2013 04:06
SQL Utilities for Oracle
-- PL/SQL Debugging Setup
-- See [PL/SQL Debugging Setup](http://docs.oracle.com/html/B31355_01/plsql_debugging_setup.htm). Essentially, you just need to grant necessary privileges to the user for debugging
GRANT DEBUG CONNECT SESSION TO USER
GRANT DEBUG ANY PROCEDURE TO USER
-- Find PL/SQL Definition
-- The definition of PACKAGE, PROCEDURE, TRIGGER, FUNCTION can be found in USER_SOURCE table or ALL_SOURCE table. Here is an example.
SELECT name, LISTAGG(text) WITHIN GROUP (ORDER BY line) AS plsql
FROM ALL_SOURCE
WHERE type='PROCEDURE' AND name='<procedure name in upper case>'
@sungitly
sungitly / ebs_utilities.sql
Created December 5, 2013 04:09
EBS SQL Utilities
-- Setup EBS context
fnd_global.apps_initialize(user_id, responsibility_id, responsibility_application_id);
@sungitly
sungitly / android_resize_bitmap.java
Last active August 29, 2015 13:57
Resize bitmap in Android
Bitmap origBitmapOrig = BitmapFactory.decodeFile(imageFilePath);
//Resize the image
double width = origBitmapOrig.getWidth();
double height = origBitmapOrig.getHeight();
int newWidth = 1600
int newHeight = (int)((newWidth/width)*height);
Bitmap newBitmap = Bitmap.createScaledBitmap(origBitmapOrig, newWidth, newHeight, true);
@sungitly
sungitly / git.bash
Created March 20, 2014 02:04
Useful Git Command
git config --global credential.helper store
@sungitly
sungitly / email.php
Created March 20, 2014 02:07
Send Email Through SMTP (SSL) Using Zend
<?php
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mail\Transport\SmtpOptions;
use Zend\Mail\Message;
public function sendEmail($to, $subject, $body){
$message = new Message();
$message->addTo($to)
->addFrom('helpdesk@example.com')
@sungitly
sungitly / android_tips.md
Created March 21, 2014 12:41
Android Tips

px = dp * (dpi / 160)

@sungitly
sungitly / sign_android.sh
Created April 1, 2014 09:27
Android Signning
// Generate a private key
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
// View generated key store
keytool -list -v -keystore release.keystore
// Sign the application
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name
@sungitly
sungitly / todict.py
Last active November 15, 2023 21:04
convert python object recursively to dict
def todict(obj, classkey=None):
if isinstance(obj, dict):
data = {}
for (k, v) in obj.items():
data[k] = todict(v, classkey)
return data
elif hasattr(obj, "_ast"):
return todict(obj._ast())
elif hasattr(obj, "__iter__"):
return [todict(v, classkey) for v in obj]
@sungitly
sungitly / jsonencoder.py
Created January 26, 2015 16:00
python json encoder to encode object json with exclusions
class ComplexEncoder(json.JSONEncoder):
def __init__(self, skipkeys=False, ensure_ascii=True,
check_circular=True, allow_nan=True, sort_keys=False,
indent=None, separators=None, encoding='utf-8', default=None, excluded=None):
super(ComplexEncoder, self).__init__(skipkeys, ensure_ascii, check_circular, allow_nan, sort_keys, indent,
separators, encoding, default)
self.excluded = excluded
def default(self, obj):
if hasattr(obj, "__dict__"):