Skip to content

Instantly share code, notes, and snippets.

🐳
Working from home

Oshan Wisumperuma oshanz

🐳
Working from home
Block or report user

Report or block oshanz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@oshanz
oshanz / ssh message
Created Jan 23, 2014
Send message to remote PC via SSH
View ssh message
ssh -X login
export DISPLAY=:0
xmessage 'hi'
xdialog 'hi'
libnotify 'hi'
notify-send 'hi'
View jquery date range
$(document).ready(function() {
$("#From").datepicker({
dateFormat: "yy-mm-dd",
changeMonth: true,
changeYear: true,
maxDate: new Date(),
onClose: function(selectedDate) {
$("#To").datepicker("option", "minDate", selectedDate);
}
});
@oshanz
oshanz / jquery date as sql format
Created Jan 25, 2014
jquery date as sql format
View jquery date as sql format
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
$('#datePicker').val(today);
View ajax
$.ajax({
type: 'post',
url: URL + 'index/updateDetails',
data: $('#form_updateUserDetails').serialize(),
//data: {'page': page, 'from': $('#From').val(), 'to': $('#To').val()},
success: function(data) {
// console.log(data);
$('#user_up_error').html(data);
setErrorOff();
listup();
@oshanz
oshanz / htm tabl 2 excel - function
Last active Jan 4, 2016
client side html table export to excel
View htm tabl 2 excel - function
function ExportExcel(table) {
if (!table.nodeType) {
table = document.getElementById(table);
download(table.outerHTML, "ftable.xls", "application/vnd.ms-excel");
}else{
alert('not a tbl');
}
}
View java se proxy
//use manual settings
System.setProperty("http.proxyHost", host);
System.setProperty("http.proxyPort", port);
//use system proxy
System.setProperty("java.net.useSystemProxies", "true");
@oshanz
oshanz / 3cpo log off
Last active Jan 4, 2016
3cpo log off
View 3cpo log off
turning off the default log (optional)
Properties p = new Properties(System.getProperties());
p.put("com.mchange.v2.log.MLog", "com.mchange.v2.log.FallbackMLog");
p.put("com.mchange.v2.log.FallbackMLog.DEFAULT_CUTOFF_LEVEL", "OFF");
System.setProperties(p);
View git
git instaweb --httpd=apache2
localhost:1234
git_stats generate
git_stats
gitstats
gitstats generate
gitstats generate -o stats
gitstats -o stats
gitstats -o
View mysql variable
$query = "SELECT * ,
@amount:=(SELECT SUM((`ghi_qty`*`g_price`)) FROM `tbl_grn_has_item` ghi WHERE ghi.`idgrn`= grn.`idgrn`) AS amount,
(@amount-(@amount*(grn.g_discount/100))) AS `grandtotal`,
(@amount*(grn.g_discount/100)) AS `discount`
FROM `tbl_grn` grn
INNER JOIN `tbl_delivery_note` dn ON grn.`iddelivery_note`= dn.`iddelivery_note`
INNER JOIN `tbl_purchase_order` po ON dn.`idpurchase_order`= po.`idpurchase_order`
INNER JOIN `tbl_user` tu ON po.`idposition`=tu.`iduser` WHERE grn.`g_status`='0' aND po.`idposition`='{$user_id}'{$querypart}";
View java post request
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package send_sms;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
You can’t perform that action at this time.