Skip to content

Instantly share code, notes, and snippets.

View meadhikari's full-sized avatar
🏠
Working from home

Bikram Adhikari meadhikari

🏠
Working from home
View GitHub Profile
long beforeUsedMemA=Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory();
// i do my thing
long afterUsedMemA=Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory();
long actualMemUsedA=afterUsedMemA-beforeUsedMemA;
// actualMemUsedA is negative
long beforeUsedMemA=Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory();
// i do my thing
long afterUsedMemA=Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory();
long actualMemUsedA=afterUsedMemA-beforeUsedMemA;
// actualMemUsedA is negative
#!/usr/bin/env python
#Usage
#script.py -r <region name>(optional) -e <environment tagname> <action>[start|stop|status]
from optparse import OptionParser
import boto.ec2
def get_options():
global options
parser = OptionParser(usage="usage: %prog [options] start|stop|status", version="%prog 1.0")
# Required metadata
sonar.projectKey=java-sonar-runner-hybris
sonar.projectName=HYBRIS
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=bin/custom
# Language
sonar.language=java
@meadhikari
meadhikari / Readme.md
Last active August 29, 2015 14:19 — forked from EHadoux/Readme.md

Description

This is a dashing widget intended to show metrics from a sonar repository.

Usage

This widget currently uses the list widget as a view. You just have to add this snippet to your dashboard:

@meadhikari
meadhikari / deactivate.ps1
Created February 20, 2015 09:18
Powershell script to deactivate user who have not logged in for 30 days
$connection = new-object System.Data.SqlClient.SQLConnection("Data Source=.;Integrated Security=SSPI;Initial Catalog=aspnetdb");
$cmd = new-object System.Data.SqlClient.SqlCommand("UPDATE dbo.aspnet_Membership SET IsApproved = 0 where LastLoginDate < DATEADD(DAY, -30, GETDATE())", $connection);
$connection.Open();
$reader = $cmd.ExecuteNonQuery()
$connection.Close();
Write-output $reader
import urllib2
import re
from lxml import html
def school_type(school_report):
import cStringIO
from lxml import etree
from BeautifulSoup import BeautifulSoup
import urllib2
import re
from lxml import html
button.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
// the button is down monitor time to see how long it is down or anything you want
} else if (event.getAction() == MotionEvent.ACTION_UP) {
// the button is up reset your timer
}
}
};
button.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN) {
increaseSize();
} else if (event.getAction() == MotionEvent.ACTION_UP) {
resetSize();
}
}
};